-
Notifications
You must be signed in to change notification settings - Fork 184
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
MAINT: unify code style #1236
Comments
I am a bit warry of changing our casing in Python to be more Python like. We once have start_jvm and startJVM IRC. We are talking to Java and thus presenting a camel case language. I don't have any problem with making variable names follow the Python conventions, but our public interface is what it is and we shouldn't make changes to it. (Darn autocorrect changed shouldnt to should) |
you're right, we should not change the API and the camel case argument is strong. |
There is also the need to be careful with python formatting tools since some Java imports need to come after the JVM is started. I'm not sure how much of the jpype codebase that would effect though. I'm a big fan of the clang tools. while I haven't used clang format all that much, I like clang-tidy. It's nice to have a modern linter for C/C++. It complains about everything (which is a good thing), and is about as configurable as linters for other modern languages. For the camel case Python API, you could always just create aliases. This way it will always "feel right" whether you're coming from Python or Java. It looks like NetBeans has support for the eclipse formatter, as do most Java IDEs I think. It's probably the best bet for Java. |
My worst nightmare 😄 (#933)
The thing is that this would also need to alias the Java methods too... then when you implement an interface there is an ambiguity which form you should implement, and even a risk that there are two different implementations. I think it is an idea worth discussing (if it hasn't already been discussed elsewhere) - I would be interested to explore the idea, but probably best as its own topic.
👍 on ruff. I would suggest we use pre-commit for iterative improvements rather than doing it in a single big-bang formatting change. |
@ALL lets please forget about the Python camel casing. We can also set it up as a rule we're explicitly breaking (in Ruff). @astrelsky Which commands/linting configuration would you recommend using for C++ utilizing clang-tidy? I can then set it up for continuous integration. |
I'll pull the commands from my ide logs tonight. I figure that's more helpful than telling you I don't know 😂 |
We have automatic formatting for Python on checkin. We just need a working beautifier for C and Java. |
The attached file was generated with the command below. I'm assuming those
There is a convenient list of the check groups here. I just manually disable some once I get fed up and think a specific check isn't helpful. https://clang.llvm.org/extra/clang-tidy/#using-clang-tidy Leave ALL alone, they didn't do anything wrong! it should obviously be |
Currently we do not have or use a coding style. For instance:
camel casing in Python).To mitigate some of the problems, I'd suggest to use formatting tools like Ruff, clang-format etc with rule-sets stored in the repository. That way everybody can use them. We could also enforce them later with git commit hooks.
I think the project would benefit in the long term by doing that, because it lowers the burden of reading into the code for new developers.
EDIT:
setup CI to use
The text was updated successfully, but these errors were encountered: