Index: .coafile =================================================================== --- .coafile +++ .coafile @@ -1,6 +1,7 @@ [Source] -bears = CPPCheckBear, LicenseYearBear +bears = AStyleBear, CPPCheckBear, LicenseYearBear language = c++ +astyle_config = build/coala/lint-config/astylerc files = source/**.(cpp|h) ignore = source/third_party Index: build/coala/AStyleBear.py =================================================================== --- /dev/null +++ build/coala/AStyleBear.py @@ -0,0 +1,35 @@ +from coalib.bearlib.abstractions.Linter import linter +from dependency_management.requirements.DistributionRequirement import ( + DistributionRequirement) + + +@linter(executable='astyle', + output_format='corrected') +class AStyleBear: + """ + Artistic Style is a source code indenter, formatter, + and beautifier for the C, C++, C++/CLI, Objective-C, + C# and Java programming languages. + """ + + LANGUAGES = {'C', 'CPP', 'Objective-C', 'C#', 'Java'} + REQUIREMENTS = {DistributionRequirement('astyle')} + AUTHORS = {'Nicolas Auvray'} + LICENSE = 'GPL-2.0' + CAN_FIX = {'Formatting'} + SEE_MORE = 'http://astyle.sourceforge.net/astyle.html' + + @staticmethod + def create_arguments(filename, file, config_file, + astyle_config: str = '', + ): + """ + :param astyle_config: + The location of the astylerc config file. + """ + args = ('--stdin='+filename,) + + if astyle_config: + args += ('--options='+astyle_config,) + + return args Index: build/coala/lint-config/astylerc =================================================================== --- /dev/null +++ build/coala/lint-config/astylerc @@ -0,0 +1,21 @@ +# Brace style +--style=allman +# Tab options +--indent=tab +# Brace modify options +--attach-closing-while +# Indentation options +--indent-after-parens +--min-conditional-indent=0 +# Padding options +--pad-comma +--pad-header +--unpad-paren +--align-pointer=type +# Formatting options +--break-one-line-headers +--remove-braces +--attach-return-type +--close-templates +--max-code-length=200 +--mode=c Index: build/jenkins/dockerfiles/coala.Dockerfile =================================================================== --- build/jenkins/dockerfiles/coala.Dockerfile +++ build/jenkins/dockerfiles/coala.Dockerfile @@ -3,6 +3,7 @@ RUN useradd --uid 1006 builder RUN apt-get -yy update && apt-get -yy install \ + astyle \ cppcheck \ git \ npm \