Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

[WIP] Add sanity tests for site to avoid failed deploys #139

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .coafile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[all]
ignore = .git/
bear_dirs = bears

[all.json]
bears = JSONFormatBear,DuplicateProjectNamesBear
files = data/projects.json
indent_size = 2

# [all.png]
# bears = ImageSizeBear
# files = README.md
# width = 1000
# height = 800
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ build/
elm.js
assets/styles.css
npm-debug.log

data/projects.json.orig
bears/__pycache__
51 changes: 51 additions & 0 deletions bears/DuplicateProjectNamesBear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from coalib.bears.LocalBear import LocalBear
import json
import collections
from collections import OrderedDict
from coalib.results.Result import Result


class DuplicateProjectNamesBear(LocalBear):

LANGUAGES = {'JSON'}
AUTHORS = {'DailyDrip'}
AUTHORS_EMAILS = {'[email protected]'}
LICENSE = 'AGPL-3.0'

def run(self,
filename,
file):
# Output a meaningful message if empty file given as input
if len(file) == 0:
yield Result.from_values(self,
'This file is empty.',
file=filename)
return

try:
json_content = json.loads(''.join(file),
object_pairs_hook=OrderedDict)
except JSONDecodeError as err:
err_content = match(r'(.*): line (\d+) column (\d+)', str(err))
yield Result.from_values(
self,
'This file does not contain parsable JSON. ' +
err_content.group(1) + '.',
file=filename,
line=int(err_content.group(2)),
column=int(err_content.group(3)))
return

project_names = list(map(lambda entry: entry['name'], json_content))
duplicates = [item for item, count in collections.Counter(project_names).items() if count > 1]
print(duplicates)

if len(duplicates) > 0:
yield Result.from_values(
self,
'The following project names are duplicated: ' +
', '.join(duplicates),
file=filename
)

return
17 changes: 17 additions & 0 deletions bears/ImageSizeBear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from coalib.bearlib.abstractions.Linter import linter
from coalib.results.Result import Result

@linter(executable='identify')
class ImageSizeBear:
USE_RAW_FILES = True

def process_output(self, output, filename, file,
width: int, height: int):
return true

@staticmethod
def create_arguments(filename, file, config_file):
"""
Bear configuration arguments.
"""
return (filename)
49 changes: 30 additions & 19 deletions data/projects.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"repositoryUrl": "https://github.com/rkrupinski/yt-repeater",
"description": "YouTube repeater built with Elm."
},
{
{
"name": "Graft3D",
"previewImageUrl": "data/images/graft3d.png",
"primaryUrl": "https://jesseilev.github.io/graft3d",
Expand All @@ -20,43 +20,50 @@
"repositoryUrl": null,
"description": "The instantaneous pace calculator for runners."
},
{ "name": "Sandwich Delivery Game",
{
"name": "Sandwich Delivery Game",
"previewImageUrl": "data/images/sandwich-delivery-game.png",
"primaryUrl": "https://sandwich-delivery-game-webapp.s3.eu-central-1.amazonaws.com/index.html",
"repositoryUrl": "https://github.com/innoq/sandwich-delivery-game",
"description": "A Sandwich Delivery Game. A blog post describing the development of the game can be found in the github repo."
},
{ "name": "Facebook Browser",
{
"name": "Facebook Browser",
"previewImageUrl": "data/images/facebook-browser.png",
"primaryUrl": "https://specious.github.io/facebook-browser",
"repositoryUrl": "https://github.com/specious/facebook-browser",
"description": "Search Facebook pages by name."
},
{ "name": "Asteroids",
{
"name": "Asteroids (justinmimbs)",
"previewImageUrl": "data/images/asteroids2.png",
"primaryUrl": "https://justinmimbs.github.io/asteroids/",
"repositoryUrl": "https://github.com/justinmimbs/asteroids",
"description": "A game based on Asteroids Deluxe by Atari."
},
{ "name": "Alertmanager",
{
"name": "Alertmanager",
"previewImageUrl": "data/images/alertmanager.png",
"primaryUrl": "https://prometheus.io/docs/alerting/alertmanager/",
"repositoryUrl": "https://github.com/prometheus/alertmanager",
"description": "Deduplicates, groups and routes alerts send by monitoring systems like Prometheus to services like PagerDuty, OpsGenie or plain e-mail."
},
{ "name": "carna.io",
{
"name": "carna.io",
"previewImageUrl": "data/images/carna-io.png",
"primaryUrl": "https://www.carna.io",
"repositoryUrl": "https://github.com/scepticulous/carna-ng",
"description": "Body index and body fat percentage calculator in Elm."
},
{ "name": "elm-hangman",
{
"name": "elm-hangman",
"previewImageUrl": "data/images/elm-hangman.png",
"primaryUrl": "http://puemos.github.io/elm-hangman/",
"repositoryUrl": "https://github.com/puemos/elm-hangman/",
"description": "The game of Hangman written in Elm."
},
{ "name": "G.O.A.T.",
{
"name": "G.O.A.T.",
"previewImageUrl": "data/images/goat.png",
"primaryUrl": "http://gregziegan.com/goat/",
"repositoryUrl": "https://github.com/thebritican/goat",
Expand Down Expand Up @@ -105,7 +112,7 @@
"description": "A Tic Tac Toe implementation with minimax built in. For freeCodeCamp."
},
{
"name": "Elm Snake",
"name": "Elm Snake (nwjlyons)",
"previewImageUrl": "data/images/nwjlyons-elm-snake.png",
"primaryUrl": "http://snake.neillyons.io",
"repositoryUrl": "https://github.com/nwjlyons/snake",
Expand Down Expand Up @@ -133,7 +140,7 @@
"description": "A guide to harmful and poisonous plants in Nova Scotia, developed with content from the botany curator of the Nova Scotia Museum and input from the IWK Regional Poison Centre"
},
{
"name": "Elm Snake",
"name": "Elm Snake (rkrupinski)",
"previewImageUrl": "data/images/elm-snake.png",
"primaryUrl": "https://rkrupinski.github.io/elm-snake/",
"repositoryUrl": "https://github.com/rkrupinski/elm-snake",
Expand Down Expand Up @@ -258,7 +265,8 @@
"repositoryUrl": "https://github.com/astynax/elm-hekoish-watch",
"description": "A simple cryptic fullscreen watch inspired by Tokyoflash \"Heko\" wristwatch"
},
{ "name": "Elm Christmas tree",
{
"name": "Elm Christmas tree",
"previewImageUrl": "data/images/elm-xmas-tree.png",
"primaryUrl": "https://astynax.github.io/elm-xmas-tree",
"repositoryUrl": "https://github.com/astynax/elm-xmas-tree",
Expand All @@ -271,13 +279,15 @@
"repositoryUrl": "https://github.com/3tty0n/elm-online-markdown-editor",
"description": "An online markdown editor written in Elm."
},
{ "name": "MovieInfo",
{
"name": "MovieInfo",
"previewImageUrl": "data/images/MovieInfo.jpg",
"primaryUrl": "https://ciavash.gitlab.io/MovieInfo/",
"repositoryUrl": "https://gitlab.com/CIAvash/MovieInfo",
"description": "Information and ratings for Movies, TV Series and games"
},
{ "name": "Orbiter 13",
{
"name": "Orbiter 13",
"previewImageUrl": "http://i.imgur.com/6aKzubg.png",
"primaryUrl": "http://www.chadtech.us/orbiter-13/",
"repositoryUrl": "https://github.com/Chadtech/Orbiter-d",
Expand All @@ -298,7 +308,7 @@
"description": "A simple TicTacToe game."
},
{
"name": "Minesweeper",
"name": "Minesweeper (julianjelfs)",
"previewImageUrl": "data/images/minesweeper.png",
"primaryUrl": "https://julianjelfs.github.io/elm-minesweeper/dist/index.html",
"repositoryUrl": "https://github.com/julianjelfs/elm-minesweeper",
Expand All @@ -312,7 +322,7 @@
"description": "Playing with electronic circuits."
},
{
"name":"Tabata Timer",
"name": "Tabata Timer",
"previewImageUrl": "data/images/tabata-timer.png",
"primaryUrl": "https://github.com/jackysee/tabata-timer",
"repositoryUrl": "https://github.com/jackysee/tabata-timer",
Expand Down Expand Up @@ -452,7 +462,7 @@
"description": "A little sound toy"
},
{
"name": "Asteroids",
"name": "Asteroids (irh)",
"previewImageUrl": "data/images/asteroids.png",
"primaryUrl": "http://irh.github.io/asteroids",
"repositoryUrl": "https://github.com/irh/asteroids",
Expand All @@ -464,7 +474,8 @@
"primaryUrl": "http://niksilver.github.io/elm-tag-bubbles/",
"repositoryUrl": "https://github.com/niksilver/elm-tag-bubbles",
"description": "Exploring relationships between topics written about at theguardian.com"
}, {
},
{
"name": "Elm Goban",
"previewImageUrl": "data/images/elm-goban.png",
"primaryUrl": "http://mclauia.github.io/elm-goban/",
Expand Down Expand Up @@ -658,7 +669,7 @@
"previewImageUrl": "data/images/elm-street-404.jpg",
"primaryUrl": "http://zalando.github.io/elm-street-404/",
"repositoryUrl": "https://github.com/zalando/elm-street-404",
"description": "404 Elm Street a game where you have to deliver all the fashion to all the customers."
"description": "404 Elm Street \u2014 a game where you have to deliver all the fashion to all the customers."
},
{
"name": "elm-2048",
Expand Down Expand Up @@ -696,7 +707,7 @@
"description": "An SVG editor that combines programmatic and direct manipulation."
},
{
"name": "Minesweeper",
"name": "Minesweeper (SekibOmazic)",
"previewImageUrl": "data/images/elm-minesweeper.png",
"primaryUrl": "http://sekibomazic.github.io/minesweeper",
"repositoryUrl": "https://github.com/SekibOmazic/minesweeper",
Expand Down
4 changes: 4 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

# Run our linters
coala