Conversation
f8a9110 to
2be1551
Compare
|
The only three files to review on this PR are : |
3534fbd to
c58d9fa
Compare
| spell: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: crate-ci/typos@v1 |
There was a problem hiding this comment.
Thanks. This is quite useful for better code.
Could this be merged into the indent check?
There was a problem hiding this comment.
Yes it could, they are left separated for now as to not extend the indent requirement over the rest of the CI (cf. "needs: second")
Should we merge those ?
There was a problem hiding this comment.
I suggest incorporating typo checking inside indent, which will be the very first step of the CI workflow. Other CI steps will start only when the needs succeed.
There was a problem hiding this comment.
Ok, change made
Another way to proceed would be to check this indent job last (first -> second -> rest of feature tests -> indent), as a way to the feature on all CI runs, and maybe only fix the indent step once the feature is ready to be merged
There was a problem hiding this comment.
Ok, change made Another way to proceed would be to check this indent job last (first -> second -> rest of feature tests -> indent), as a way to the feature on all CI runs, and maybe only fix the indent step once the feature is ready to be merged
I think it is not optimal. In a case where only indent is not satisfied, CI will go through all tests -> indent to bring up the indent error. Then we fix the indent and the CI goes again with all tests -> indent to complete the cycle.
With the current setup, all tests will run only once, thus much cheaper
| extend-exclude = [ | ||
| "vendor/", | ||
| "pdi/docs/_template/", | ||
| "pdi/tests/PDI_expression.cxx", |
There was a problem hiding this comment.
It contains a test which itself checks for spelling mistake through dedicated lists, for example :
const vector<string> v_fpos{"y1", "YY", "yEs", "Yess", "YE5", "tru", "TrUe", "TRRUE", "onn", "0n", "ONN"};
There was a problem hiding this comment.
I see.
When looking at the cxx file, at the very last part, this section
for (auto&& string_value: v_fneg) {
...
ASSERT_EQ(PDI::Expression(string_value).to_long(context_mock), 1);
appears strange to me. Shouldn't it be comparing to 0 instead of 1?
There was a problem hiding this comment.
It seems those values aren't required :
and that we need :
EXPECT_THROW(PDI::Expression(string_value).to_long(context_mock), PDI::Error);
There was a problem hiding this comment.
isn't there a way to exclude specific lines with a comment in the file instead?
There was a problem hiding this comment.
#746 (comment)
Added option to use specific comment to mark some lines or some code block as ignored by the 'typos' check
|
|
||
| git ls-files -z | grep -zZv '^vendor/' | while IFS= read -r -d '' file; do | ||
| if [ -f "$file" ] && file --mime-type "$file" | grep -q 'text/'; then | ||
| sed -i -e 's/[ \t]*$//' -e '$a\' "$file" | ||
| fi | ||
| done |
There was a problem hiding this comment.
This is to ensure having a line break at the end of each file, to prevent the issue of a line of code shown as modified through git if later another line is appended at the end of the file (also, this is required by the C standard)
There was a problem hiding this comment.
https://github.com/CExA-project/ddc/blob/main/bin/newline_at_eof.py
Another PR will be dedicated to this, removing this change for this PR
c58d9fa to
86cd651
Compare
| PC_tree_t data_name = PC_get(data_item, "{0}"); | ||
| PC_tree_t datas = PC_get(data_item, ".%s", to_string(data_name).c_str()); | ||
| opt_each(datas, [&](PC_tree_t one_data) { | ||
| PC_tree_t data = PC_get(data_item, ".%s", to_string(data_name).c_str()); |
There was a problem hiding this comment.
I'm all in favor of fixing the doc & comments, but I'm not sure fixing the code with this is a very good idea. I'm afraid it might generate subtle bugs later.
Some variables might use a non English names because the correct English name is already used for something else. By "fixing" that, one might shadow the other variable & change behavior.
There was a problem hiding this comment.
Ideally, wouldn't this issue be fixed by using more verbose variables names ?
Incidentally, relying on specific spellings would expose us to future discrepancies
There was a problem hiding this comment.
I agree to check spelling for documentation and comments.
There was a problem hiding this comment.
A new commit now changes the behaviour of the CI step to only issue warnings
jbigot
left a comment
There was a problem hiding this comment.
good idea, but the end-of-line space check needs rework
| git ls-files -z | grep -zZv '^vendor/' | while IFS= read -r -d '' file; do | ||
| if [ -f "$file" ] && file --mime-type "$file" | grep -q 'text/'; then | ||
| sed -i -e 's/[ \t]*$//' -e '$a\' "$file" | ||
| fi | ||
| done |
There was a problem hiding this comment.
beware, this breaks the test completely!
The exit-code checked to verify if everything went fine in the CI used to be that of the last executed command, the clang-format one.
Now this comes after and completely discards the indentation test.
In addition, this does not work as a test and will never detect a typo. The last command is the loop command that has no reason to fail.
It does also not follow the logic of the command, it always applies the change, whether the --apply flag is passed or not.
Minor issues, but this uses GNU-specific sed extensions, I expect this to fail on MacOS.
Very minor issue, if any directory contains text/ in its path, everything below it will be checked.
There was a problem hiding this comment.
https://github.com/CExA-project/ddc/blob/main/bin/newline_at_eof.py
Another PR will be dedicated to this, removing this change for this PR
| [default.extend-words] | ||
| ND = "ND" | ||
| iy = "iy" | ||
| iz = "iz" | ||
| cpy = "cpy" |
There was a problem hiding this comment.
Those are considered typos by the tool, but not by us, so we define exceptions
"ND" designates N-dimensional arrays, and is a keyword mirroring "ndarray"
"iy" and "iz" are coordinates along specific dimensions (note that "ix", or "ny", "sy", "ry" are not caught by the tool)
"cpy" is mirroring the frequently used keyword of copy related to GPU use
| extend-exclude = [ | ||
| "vendor/", | ||
| "pdi/docs/_template/", | ||
| "pdi/tests/PDI_expression.cxx", |
There was a problem hiding this comment.
isn't there a way to exclude specific lines with a comment in the file instead?
|
#746 (comment) |
jmorice91
left a comment
There was a problem hiding this comment.
In the puil_request_template.md, add a line for the typos CI tools as indent.
5dad2c0 to
6d2580c
Compare
iole-bolognesi
left a comment
There was a problem hiding this comment.
Looks good, I agree with Yushan's comment that it would be useful to add the ignore options to the How_to_create_plugin.md
Add github action for typographical errors
List of things to check before making a PR
Before merging your code, please check the following:
.clang-format;Fix #issuekeyword to autoclose the issue when merged.