Skip to content

Commit

Permalink
.coafile: Check all python files
Browse files Browse the repository at this point in the history
Include **.py by default, excluding files which
are generated, and a special rule for the models.

Fixes coala#93
  • Loading branch information
jayvdb committed Mar 12, 2018
1 parent 708c8b0 commit 768b6a9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 27 deletions.
26 changes: 16 additions & 10 deletions .coafile
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
[all]
files = *.py, community/**/*.py, gci/**/*.py, activity/*.py
ignore = gci/client.py, gci/migrations/**, private/**, gsoc/migrations/**
files = **.py, **.js, **.sh
ignore = .git/**, **/__pycache__/**, gci/client.py, */migrations/**, private/*
max_line_length = 80
use_spaces = True
preferred_quotation = '

[all.whitespace]
use_spaces = True
bears = SpaceConsistencyBear
default_actions = *: ApplyPatchAction

[all.python]
files = **.py
language = Python
bears = QuotesBear, PyFlakesBear
preferred_quotation = '
default_actions = *: ApplyPatchAction

[all.autopep8]
bears = PEP8Bear, PycodestyleBear
default_actions = PEP8Bear: ApplyPatchAction
[all.python.default]
ignore += */models.py
bears = PEP8Bear, PycodestylBear, PyFlakesBear, QuotesBear
default_actions = *: ApplyPatchAction

[all.linelength]
ignore += */models.py
bears = LineLengthBear

[all.python.models]
files = */models.py
bears = LineLengthBear, PycodestylBear, PyFlakesBear, QuotesBear
max_line_length = 120

[all.links]
bears = InvalidLinkBear

Expand All @@ -36,11 +42,11 @@ files = *.sh
bears = ShellCheckBear
shell = bash

[generalization]
[all.generalization]
# Do not allow the word "coala" to ensure the repository can be generalized out
# for use by other organizations.
files = **
ignore = .git/**, org_name.txt, .coafile, requirements.txt, .travis.yml, LICENSE, public/**, _site/**
ignore += org_name.txt, .coafile, requirements.txt, .travis.yml, LICENSE, public/**, _site/**
bears = KeywordBear
language = python 3
keywords = coala
26 changes: 13 additions & 13 deletions data/management/commands/import_contributors_data.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import requests
import json

from community.git import get_owner
from data.models import Contributor
from django.core.management.base import BaseCommand
from community.git import get_owner

org_name =get_owner()
IMPORT_URL = 'https://webservices.'+org_name+'.io/contrib/'
org_name = get_owner()
IMPORT_URL = 'https://webservices.' + org_name + '.io/contrib/'


class Command(BaseCommand):
Expand All @@ -19,19 +19,19 @@ def import_data(self, contributor):

try:
c, created = Contributor.objects.get_or_create(
login = login,
name = name,
bio = bio,
num_commits = num_commits,
issues_opened = issues_opened,
reviews = reviews
login=login,
name=name,
bio=bio,
num_commits=num_commits,
issues_opened=issues_opened,
reviews=reviews
)
if created:
c.save()
print ("\nContributor, {}, has been saved.".format(c))
print('\nContributor, {}, has been saved.'.format(c))
except Exception as ex:
print ("\n\nSomething went wrong saving this contributor: {}\n{}".format(login, str(ex)))

print('\n\nSomething went wrong saving this contributor: {}\n{}'
.format(login, str(ex)))

def handle(self, *args, **options):
"""
Expand Down
2 changes: 1 addition & 1 deletion data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Contributor(models.Model):
issues_opened = models.IntegerField(default=None, null=True)

def __str__(self):
return self.name
return self.name

class Meta:
ordering = ['login']
7 changes: 4 additions & 3 deletions data/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from data.models import Contributor
from django.shortcuts import render


def index(request):
contributors = Contributor.objects.all()
args = {"contributors": contributors}
return render(request, 'contributors.html', args)
contributors = Contributor.objects.all()
args = {'contributors': contributors}
return render(request, 'contributors.html', args)
2 changes: 2 additions & 0 deletions log/view_log.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from django.http import HttpResponse


def index(request):
logs = get_logs()
return HttpResponse('<br>'.join(logs))


def get_logs():
with open('./_site/community.log') as log_file:
for line in log_file:
Expand Down

0 comments on commit 768b6a9

Please sign in to comment.