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

Ignore MOODLE_INTERNAL sniff for all Behat classes. #157

Closed
paulholden opened this issue Nov 8, 2021 · 0 comments · Fixed by #158
Closed

Ignore MOODLE_INTERNAL sniff for all Behat classes. #157

paulholden opened this issue Nov 8, 2021 · 0 comments · Fixed by #158

Comments

@paulholden
Copy link
Member

Mentioned by @stronk7 - we should check whether the file contains a /behat/ folder in it's path, rather than it's immediate descendant having that name:

// Special dispensation for behat files.
if (basename(dirname($file->getFilename())) === 'behat') {
return;
}

See MDL-72696 (fails for file lib/behat/form_field/behat_form_inplaceeditable_select.php)

stronk7 added a commit to stronk7/moodle-local_codechecker that referenced this issue Nov 8, 2021
Previously it was simply skipping any file straight under a
"behat" directory. So, at very least these 2 cases were being
handled incorrectly:

1. Subdirectories under "behat" were not skipped.
2. admin/behat directory was being incorrectly skipped.

Now, being able to calculate moodle root, we are going to skip:
1. Any file within dirroot having "/tests/behat" in the path.
2. Any file within dirroot having "/lib/behat" in the path.
3. Any file within dirroot having "/lang/" in the path.

With thatm the 2 original problems should be fixed. Covered.

Fixes moodlehq#157.
stronk7 added a commit to stronk7/moodle-local_codechecker that referenced this issue Nov 8, 2021
Previously it was simply skipping any file straight under a
"behat" directory. So, at very least these 2 cases were being
handled incorrectly:

1. Subdirectories under "behat" were not skipped.
2. admin/behat directory was being incorrectly skipped.

Now, being able to calculate moodle root, we are going to skip:
1. Any file within dirroot having "/tests/behat/" in the path.
2. Any file within dirroot having "/lib/behat/" in the path.
3. Any file within dirroot having "/lang/" in the path.

With that the 2 original problems should be fixed.

Covered with unit tests.

Fixes moodlehq#157.
stronk7 added a commit that referenced this issue Nov 9, 2021
Previously it was simply skipping any file straight under a
"behat" directory. So, at very least these 2 cases were being
handled incorrectly:

1. Subdirectories under "behat" were not skipped.
2. admin/behat directory was being incorrectly skipped.

Now, being able to calculate moodle root, we are going to skip:
1. Any file within dirroot having "/tests/behat/" in the path.
2. Any file within dirroot having "/lib/behat/" in the path.
3. Any file within dirroot having "/lang/" in the path.

With that the 2 original problems should be fixed.

Covered with unit tests.

Fixes #157.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant