Skip to content

Commit

Permalink
PHPCodeSnifferBear: Deduplicate error results
Browse files Browse the repository at this point in the history
Sets `absolute_line_length` to '0' to disable two different error
outputs.

Closes coala#1950
  • Loading branch information
idealrealism authored and gitmate-bot committed Dec 13, 2017
1 parent 9a27ceb commit d63635b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bears/php/PHPCodeSnifferBear.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class is on the next line, and that the closing brace for a class
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="{max_line_length}"/>
<property name="absoluteLineLimit" value="{absolute_line_length}"/>
</properties>
</rule>
<rule ref="Generic.Files.LineEndings">
Expand Down Expand Up @@ -162,6 +163,7 @@ class is on the next line, and that the closing brace for a class
</rule>
</ruleset>
'''.format(max_line_length=max_line_length,
absolute_line_length=0,
line_ending_character=line_ending_character,
indent_size=indent_size,
some_rules=rules,
Expand Down
24 changes: 24 additions & 0 deletions tests/php/PHPCodeSnifferBearTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,33 @@
$var = FALSE;
"""

long_length_test_file = """<?php
/**
* PHP_CodeSniffer tokenizes PHP code and detects violations of a defined set \
of coding.This is to test that the absoluteLineLength is violated or not.
* PHP version 5
*
* @category PHP
* @package Your_Package
* @author John Snow <[email protected]>
* @license https://licence.txt LICENSE
* @link http://somelink
*/
>
"""


PHPCodeSnifferBearTest = verify_local_bear(
PHPCodeSnifferBear,
valid_files=(good_file,),
invalid_files=(bad_file,),
tempfile_kwargs={'suffix': '.php'})


PHPCodeSnifferBearLineLengthTest = verify_local_bear(
PHPCodeSnifferBear,
valid_files=(long_length_test_file,),
invalid_files=(),
settings={'max_line_length': '160'},
tempfile_kwargs={'suffix': '.php'})

0 comments on commit d63635b

Please sign in to comment.