-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add vim modeline. #420
Add vim modeline. #420
Conversation
By the way, I have found many modeline written in different form. Should these modeline be re-written? for example, instead of modmesh/cpp/modmesh/buffer/BufferExpander.hpp Line 143 in 3211479
|
I think we can use the longest version as it includes all other versions' settings. 🤔 |
@yungyuc I have added one vim modeline. Please help me review it. Thank. |
In modmesh/gtests/, it seems that the vim modeline should be added in some of the files. @dragonwu0919, could you please check more files and add more missing vim modelines? Thank you. |
I concur. @dragonwu0919 it will help you get familiar with the code base to scan through all files for a specific style conformity/violation. Why don't you compile a list of all files that need to fix for the modeline? |
@ThreeMonth03 Sure, I can help add the missing vim modeline back. @yungyuc Thank you for the review and the suggestion. I will try to compile them when fixing modelines. |
3211479
to
cbfa15a
Compare
It looks like you've successfully rebased and squashed the commits. @dragonwu0919, could you please remove the "Add Vim modelines 2" commit message because it is meaningless? Thank you. |
@ThreeMonth03 Sorry for asking a basic question, but may i ask how to remove that commit? My log shows that the commit "Add Vim modeline 2" has been deleted in my local repo.
|
Sorry for my unclear explanation. I think you should rebase and reword the commit |
BTW, if you enter |
cbfa15a
to
d7585de
Compare
Thanks, @dragonwu0919, the commit message is satisfying. |
@ThreeMonth03 Thank you for the reminding. I never thought that |
@yungyuc Sorry for bothering you further. You suggested that I could compile those files when fixing the modeline problem, but I don't understand what the word compile means in this context. Should I literally find a compiler to compile the files, or is it just suggesting that I could read the pattern of how the code is written here? |
By "compile a list of all files that need to fix for the modeline", I meant to make a list of all files that need to fix for the modeline. |
Understood. I will try my best to do so. |
eea8f36
to
eb80816
Compare
@yungyuc The files that have been updated with Vim modelines are listed below. Please review the overall changes. Thank you. {
"WithoutModeline": [
".\\setup.py",
".\\cpp\\modmesh\\buffer\\pymod\\TypeBroadcast.hpp",
".\\cpp\\modmesh\\inout\\pymod\\wrap_Gmsh.cpp",
".\\cpp\\modmesh\\inout\\pymod\\wrap_Plot3d.cpp",
".\\cpp\\modmesh\\onedim\\Euler1DCore.cpp",
".\\cpp\\modmesh\\onedim\\Euler1DCore.hpp",
".\\cpp\\modmesh\\spacetime\\kernel\\BadEuler1DSolver.cpp",
".\\cpp\\modmesh\\spacetime\\kernel\\BadEuler1DSolver.hpp",
".\\cpp\\modmesh\\testhelper\\pymod\\testbuffer_pymod.cpp",
".\\modmesh\\params.py",
".\\modmesh\\app\\euler1d.py",
".\\tests\\test_gmsh.py"
]
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The files that have been updated with Vim modelines are listed below. Please review the overall changes. Thank you.
{ "WithoutModeline": [ ".\\setup.py", ".\\cpp\\modmesh\\buffer\\pymod\\TypeBroadcast.hpp", ".\\cpp\\modmesh\\inout\\pymod\\wrap_Gmsh.cpp", ".\\cpp\\modmesh\\inout\\pymod\\wrap_Plot3d.cpp", ".\\cpp\\modmesh\\onedim\\Euler1DCore.cpp", ".\\cpp\\modmesh\\onedim\\Euler1DCore.hpp", ".\\cpp\\modmesh\\spacetime\\kernel\\BadEuler1DSolver.cpp", ".\\cpp\\modmesh\\spacetime\\kernel\\BadEuler1DSolver.hpp", ".\\cpp\\modmesh\\testhelper\\pymod\\testbuffer_pymod.cpp", ".\\modmesh\\params.py", ".\\modmesh\\app\\euler1d.py", ".\\tests\\test_gmsh.py" ] }
Thanks. It is clear. Having said that, it will look nicer in the review by using a markdown list:
setup.py
cpp/modmesh/buffer/pymod/TypeBroadcast.hpp
cpp/modmesh/inout/pymod/wrap_Gmsh.cpp
cpp/modmesh/inout/pymod/wrap_Plot3d.cpp
cpp/modmesh/onedim/Euler1DCore.cpp
cpp/modmesh/onedim/Euler1DCore.hpp
cpp/modmesh/spacetime/kernel/BadEuler1DSolver.cpp
cpp/modmesh/spacetime/kernel/BadEuler1DSolver.hpp
cpp/modmesh/testhelper/pymod/testbuffer_pymod.cpp
modmesh/params.py
modmesh/app/euler1d.py
tests/test_gmsh.py
(Simple regular expressions can convert the json to the markdown list.)
Need to change:
- Make sure all line endings uses Unix LF (
\n
).
@@ -234,3 +234,5 @@ struct TypeBroadcast | |||
|
|||
} /* end namespace python */ | |||
} /* end namespace modmesh */ | |||
\r\n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that you have some lines mixed with dos/windows CF+LF plain-text line ending. Please correct them.
You probably did not configure your editor correctly.
4d61870
to
33734c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Keep only one newline after the vim modeline.
You may refer cpp/modmesh/buffer/SimpleArray.cpp and this explanation to modify the files.
} /* end namespace modmesh */ No newline at end of file | ||
} /* end namespace modmesh */ | ||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether there should be a newline between the bracket and the vim modeline. @yungyuc, how do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to leave a blank line between the modeline and the code above it.
} // namespace modmesh | ||
|
||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline (\n).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modmesh/app/euler1d.py
Outdated
|
||
# vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the editor, it is clear that there are two newlines after the vim modeline, and the github action should fail under this circumstance.
Thus, you may modify this part according to the following rules:
- There should be only a newline after the vim modeline.
- The newline should not contain any character, such as the tab
'\t'
and the space
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 newlines.
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 newlines.
} // namespace modmesh | ||
|
||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modmesh/params.py
Outdated
# vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 newlines.
setup.py
Outdated
# vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 newlines.
tests/test_gmsh.py
Outdated
# vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 newlines.
@@ -515,3 +515,5 @@ SimpleArrayPlex::~SimpleArrayPlex() | |||
} | |||
|
|||
} /* end namespace modmesh */ | |||
|
|||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is only one newline after the vim modeline, good job.
c0c7428
to
3b58c72
Compare
Hope it doesn't go wrong this time. @yungyuc, could you please help me review the changes? Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Add the missing newline in gtests/test_nopython_callprofiler.cpp, gtests/test_nopython_inout.cpp and gtests/test_nopython_serializable.cpp.
@dragonwu0919 I think after the slight modification to the above files, we could merge this pr. Thank's for your contribution.
} // namespace modmesh | ||
|
||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gtests/test_nopython_inout.cpp
Outdated
@@ -314,3 +314,5 @@ TEST(Gmsh_Parser, Hexahedron125NodeDefinition) | |||
EXPECT_EQ(ele_def.mmtpn(), 5); | |||
EXPECT_THAT(ele_def.mmcl(), testing::ElementsAre(0, 1, 2, 3, 4, 5, 6, 7)); | |||
} | |||
|
|||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} // namespace modmesh | ||
|
||
// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. It would be nice to have consistent new line after the modeline, but this is indeed very easy to miss when we only review a limited number of source files. When it is for developing a feature or fixing a bug, the inconsistency at the end of file is fine. Picking a minor issue like that after a great effort of hacking can be discouraging. But for a (style) refactoring PR like this, it good to make the style as consistent as possible, because its sole purpose is to make the style perfect. |
3b58c72
to
db6297f
Compare
I have completed the modifications for these three files. @yungyuc, @ThreeMonth03, thank you both very much. This experience has really helped me become more familiar with how PRs work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dragonwu0919 Thanks for your contribution. Everything looks fine now.
@dragonwu0919 We are sorry to inform you that you haven't pass all of the github workflows, and the detail of the error log could find here. You must to pass all of the the github action before merging the pr. BTW, if you want to run the github action under your repository, you can refer this article, then your repository will run the github workflows automatically. |
The C++ and Python files in this project have been scanned. Modelines have been added to those files that had no modeline at all. For files containing a modeline other than the latest version, I left them unchanged.
db6297f
to
1154006
Compare
@dragonwu0919, thank you very much. It seems that you correct the errors and pass the workflows, and it looks good to me. @yungyuc, you could review this pr when you are available, thank you. |
Thanks, @dragonwu0919 . Look good to me. Merging. |
I add vim modeline
modmesh/cpp/modmesh/buffer/SimpleArray.cpp
Line 519 in 3211479