Skip to content

Commit

Permalink
GixyBear.py: Add GixyBear
Browse files Browse the repository at this point in the history
This commit adds GixyBear.

Closes #1724
  • Loading branch information
suggoitanoshi committed Nov 5, 2018
1 parent dc8c95c commit d4f9328
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
32 changes: 32 additions & 0 deletions bears/configfiles/GixyBear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import json

from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.PipRequirement import PipRequirement
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.results.Result import Result


@linter(executable='gixy')
class GixyBear:
"""
A wrapper for coala around Gixy
see <https://github.com/yandex/gixy> for more information about the tool
"""
REQUIREMENTS={PipRequirement('gixy', '0.1.*')}

severity_map = {'HIGH': RESULT_SEVERITY.MAJOR,
'MEDIUM': RESULT_SEVERITY.NORMAL,
'LOW': RESULT_SEVERITY.INFO}

@staticmethod
def create_arguments(filename, file, config_file):
return ('--format=json', filename)

def process_output(self, output, filename, file):
output = json.loads(output) if output else []
for issue in output:
yield Result.from_values(origin=self,
message=issue['summary'],
severity=self.severity_map[issue['severity']],
file=filename)
26 changes: 26 additions & 0 deletions tests/configfiles/GixyBearTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os

from bears.configfiles.GixyBear import GixyBear
from coalib.testing.LocalBearTestHelper import verify_local_bear

good_file = """
server {
location ~ \.(gif|jpg|png)$ {
root /data/images;
}
}
"""

bad_file = """
http{
server{
location ~ /proxy/(.*)/(.*)/(.*)$ {
proxy_pass $1://$2/$3;
}
}
}
"""

GixyBearTest = verify_local_bear(GixyBear,
valid_files = (good_file, ),
invalid_files = (bad_file, ))

1 comment on commit d4f9328

@gitmate-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on d4f9328.

There are 14 results for the section all.autopep8. They have been shortened and will not be shown inline because they are more than 10.

Message File Line
The code does not comply to PEP8. tests/configfiles/GixyBearTest.py 25
E251 unexpected spaces around keyword / parameter equals tests/configfiles/GixyBearTest.py 25
E251 unexpected spaces around keyword / parameter equals tests/configfiles/GixyBearTest.py 25
E251 unexpected spaces around keyword / parameter equals tests/configfiles/GixyBearTest.py 26
E251 unexpected spaces around keyword / parameter equals tests/configfiles/GixyBearTest.py 26
The code does not comply to PEP8. bears/configfiles/GixyBear.py 13
The code does not comply to PEP8. bears/configfiles/GixyBear.py 16
The code does not comply to PEP8. bears/configfiles/GixyBear.py 30
W293 blank line contains whitespace bears/configfiles/GixyBear.py 13
E225 missing whitespace around operator bears/configfiles/GixyBear.py 16
W293 blank line contains whitespace bears/configfiles/GixyBear.py 17
E128 continuation line under-indented for visual indent bears/configfiles/GixyBear.py 30
E128 continuation line under-indented for visual indent bears/configfiles/GixyBear.py 31
E128 continuation line under-indented for visual indent bears/configfiles/GixyBear.py 32

Until GitMate provides an online UI to show a better overview, you can run coala locally for more details.

Please sign in to comment.