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

Do generated files have to follow the current coding style? #8310

Closed
irwir opened this issue Oct 5, 2023 · 7 comments
Closed

Do generated files have to follow the current coding style? #8310

irwir opened this issue Oct 5, 2023 · 7 comments

Comments

@irwir
Copy link
Contributor

irwir commented Oct 5, 2023

${$code_check} .= "${white_space}case -($error_name):\n".
"${white_space} return( \"$module_name - $description\" );\n"

This creates statements in the previous style
return( "_message ..._" );
while the current style implies
return "_message ..._";

@gilles-peskine-arm
Copy link
Contributor

No, generated files are exempt. We'd prefer to follow the coding style, but we do not enforce it, and we aren't prioritizing updating the existing files.

I started updating the existing files, but I paused that when I realized that there's one point that's hard to resolve: the code style enforces a maximum line length, whereas in some files it's very annoying to enforce a maximum line length. For example, in error.c, the coding style enforcement tool would want to either have a line break between return and the message, or keep them on the same line, depending on the exact length of the message.

@gilles-peskine-arm gilles-peskine-arm closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2023
@irwir
Copy link
Contributor Author

irwir commented Oct 5, 2023

Thanks for clarification.
The previous coding style was quite peculiar and less strict approach could be to provide more compliance, but wave troublesome requirements.

@gilles-peskine-arm
Copy link
Contributor

less strict approach could be to provide more compliance, but wave troublesome requirements

A major reason why we have a coding style is that we want to avoid noise in the form of changes where someone just restyled some code without changing its semantics (often because their editor did it automatically). This led us towards having a strict style. Furthermore, the easiest way we found to enforce the style is to canonicalize the code and reject any difference, which unfortunately forces us to be more strict than we'd like. But after about 9 months I think the new coding style has been a markedly net positive.

@irwir
Copy link
Contributor Author

irwir commented Oct 5, 2023

Speaking about noise, the files were made generated because they are to be changed on every creation.
Especially while these files exist only in releases (with additional inability to compile git head without running script, but that is a different subject).
No harm is expected if optional parentheses and spaces were removed in the script.

@irwir
Copy link
Contributor Author

irwir commented Oct 5, 2023

@gilles-peskine-arm, while on the subject of enforcing code style.
If uncrustify's output is exactly as in the current style requirements, why not process the generated files too?

@gilles-peskine-arm
Copy link
Contributor

If we process the generated files, the end result is sensitive to whether you do (1. update generated files; 2. fix code style) or (1. fix code style; 2. update generated files). We picked a way that has less hassle: #6820

To be clear, having generated files that conform to the code style is something we want, ideally. It's just lower priority than many, many other things we want.

@irwir
Copy link
Contributor Author

irwir commented Oct 5, 2023

You know the problem and working on it; Hopefully some day thing will get better.
Thanks again.

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

No branches or pull requests

2 participants