Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP MP3CheckBear: Add MP3CheckBear #1543

Open
wants to merge 1 commit 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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ addons:
- opam
- php-codesniffer
- verilator
- mp3check

cache:
pip: true
Expand Down
34 changes: 34 additions & 0 deletions bears/mp3/MP3CheckBear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from coalib.bearlib.abstractions.Linter import linter
Copy link
Member

Choose a reason for hiding this comment

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

You need to add tests as well. Though I'm not sure how you'll test this linter, this is really special. It will take mp3 as input, which is binary and not just any source file that is plain text.

from coalib.bears.LocalBear import LocalBear
from coalib.results.Result import Result
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from dependency_management.requirements.DistributionRequirement import (
DistributionRequirement)


@linter(executable='mp3check')
class MP3CheckBear(LocalBear):
"""
Report possible security weaknesses for MP3 files.
For more information,
consult <https://code.google.com/archive/p/mp3check/>.
"""
LANGUAGES = {'MP3'}
REQUIREMENTS = {DistributionRequirement(apt_get='mp3check')}
AUTHORS = {'The coala developers'}
AUTHORS_EMAILS = {'[email protected]'}
LICENSE = 'AGPL-3.0'
USE_RAW_FILES = True

@staticmethod
def create_arguments(filename, file, config_file):
return '-ase', filename

def process_output(self, output, filename, file):
lines = output.split('\n')
lines = (i for i in lines)
for msg in lines:
yield Result.from_values(origin=self,
message=msg,
file=filename,
severity=RESULT_SEVERITY.MAJOR)
Empty file added bears/mp3/__init__.py
Empty file.