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

phpmd error message change breaking CI #2943

Open
jayvdb opened this issue Aug 3, 2019 · 3 comments
Open

phpmd error message change breaking CI #2943

jayvdb opened this issue Aug 3, 2019 · 3 comments

Comments

@jayvdb
Copy link
Member

jayvdb commented Aug 3, 2019

https://ci.appveyor.com/project/jayvdb/coala-bears/builds/26448422/job/rlaneuwxk1i4lfwc#L1526

tests\php\PHPMessDetectorBearTest.py F
______________ PHPMessDetectorBearTest.test_cleancode_violation _______________
self = <tests.php.PHPMessDetectorBearTest.PHPMessDetectorBearTest testMethod=test_cleancode_violation>
    def test_cleancode_violation(self):
        file_contents = load_testfile('cleancode_violation.php')
        self.section.append(Setting('phpmd_rulesets', 'cleancode'))
        self.check_results(
            self.uut,
            file_contents,
            [Result.from_values('PHPMessDetectorBear',
                                'The method bar uses an else expression. Else '
                                'is never necessary and you can simplify the '
                                'code to work without else.',
                                file=get_testfile_path(
                                    'cleancode_violation.php'),
                                line=8)],
>           filename=get_testfile_path('cleancode_violation.php'))
tests\php\PHPMessDetectorBearTest.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
c:\python\lib\site-packages\coalib\testing\LocalBearTestHelper.py:285: in check_results
    sorted(bear_output), sorted(results))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.php.PHPMessDetectorBearTest.PHPMessDetectorBearTest testMethod=test_cleancode_violation>
observed_result = [<Result object(id=0x62f2812100024261a4e04b36c73fa491, origin='PHPMessDetectorBear', affected_code=(<SourceRange objec...ly not necessary and you can simplify the code by not using them.', aspect=NoneType, applied_actions={}) at 0x61ebf30>]
expected_result = [<Result object(id=0xa9f4fd3617d04807bdad336485fd7a6a, origin='PHPMessDetectorBear', affected_code=(<SourceRange objec...ver necessary and you can simplify the code to work without else.', aspect=NoneType, applied_actions={}) at 0x60e2510>]
    def assertComparableObjectsEqual(self, observed_result, expected_result):
        if len(observed_result) == len(expected_result):
            messages = ''
            for observed, expected in zip(observed_result, expected_result):
                if (isinstance(observed, Comparable)
                    and isinstance(expected, Comparable)) and (
                            type(observed) is type(expected)):
                    for attribute in type(observed).__compare_fields__:
                        try:
                            self.assertEqual(
                                getattr(observed, attribute),
                                getattr(expected, attribute),
                                msg='{} mismatch.'.format(attribute))
                        except AssertionError as ex:
                            messages += (str(ex) + '\n\n')
                else:
                    self.assertEqual(observed_result, expected_result)
            if messages:
>               raise AssertionError(messages)
E               AssertionError: 'The [36 chars]Else clauses are basically not necessary and y[39 chars]hem.' != 'The [36 chars]Else is never necessary and you can simplify t[25 chars]lse.'
E               - The method bar uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
E               ?                                              ^^^^  ^^^ ---------------                                         ^^^^ ^^^^ ---   ^
E               + The method bar uses an else expression. Else is never necessary and you can simplify the code to work without else.
E               ?                                              ^ ++ ^^                                          ^ ^^^^^^^   ++++ ^^^
E                : message_base mismatch.
c:\python\lib\site-packages\coalib\testing\LocalBearTestHelper.py:136: AssertionError
---------------------------- Captured stderr call -----------------------------
WARNING:root:PHPMessDetectorBear: Exit code 2

We had an issue in coala core to allow regex in our tests, to allow more flexibility for cases like that.

Probably worth doing that now, if not already nearly done, rather than trying to version check phpmd and expect different strings for different versions.

@jayvdb
Copy link
Member Author

jayvdb commented Aug 4, 2019

coala/coala#5722 was the feature request

@jayvdb
Copy link
Member Author

jayvdb commented Aug 4, 2019

We could introduce a "temporarily disabled tests" to de-select individual tests which are failing.

@jayvdb
Copy link
Member Author

jayvdb commented Aug 4, 2019

Yup that works; the failing test isnt needed for coverage.

@jayvdb jayvdb self-assigned this Aug 4, 2019
jayvdb added a commit to jayvdb/coala-bears that referenced this issue Aug 4, 2019
Custom rules in tox.ini are migrated into get_tests.py so
that they can be dynamically collated together.

Disable phpmd test test_cleancode_violation, as it is currently
failing due to a minor text change in the error emitted by the
linter.

Related to coala#2943
Related to coala#1476
jayvdb added a commit to jayvdb/coala-bears that referenced this issue Aug 5, 2019
Custom rules in tox.ini are migrated into get_tests.py so
that they can be dynamically collated together.

Disable phpmd test test_cleancode_violation, as it is currently
failing due to a minor text change in the error emitted by the
linter.

Related to coala#2943
Related to coala#1476
jayvdb added a commit to jayvdb/coala-bears that referenced this issue Aug 6, 2019
Disable PHPMessDetectorBearTest test test_cleancode_violation,
as it is currently failing due to a minor text change in the
error emitted by the linter.

Related to coala#2943
jayvdb added a commit to jayvdb/coala-bears that referenced this issue Aug 6, 2019
Disable PHPMessDetectorBearTest test test_cleancode_violation,
as it is currently failing due to a minor text change in the
error emitted by the linter.

Related to coala#2943
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant