History log of /openbmc/openbmc-build-scripts/scripts/format-code.sh (Results 1 – 25 of 58)
Revision Date Author Comments
# 1ef5c600 01-Feb-2025 Patrick Williams <patrick@stwcx.xyz>

format-code: enable meson format linting

Meson has a format utility built-in now. Use this to format
both meson.build and meson.option files so we have consistent
formatting.

Signed-off-by: Patric

format-code: enable meson format linting

Meson has a format utility built-in now. Use this to format
both meson.build and meson.option files so we have consistent
formatting.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I6ad7b24ca02ca86ddb3c45cb1b14f459349ad8ab

show more ...


# c0fab5e2 09-Sep-2024 Manojkiran Eda <manojkiran.eda@gmail.com>

Use codespell's dictionary for spell checking

When we first enabled spell checking, we duplicated the dictionary file
used by the kernel community and named it `openbmc-spelling.txt`. Since
we added

Use codespell's dictionary for spell checking

When we first enabled spell checking, we duplicated the dictionary file
used by the kernel community and named it `openbmc-spelling.txt`. Since
we added the dictionary in 2021, only two changes have been made to it.

Meanwhile, the size of the kernel community’s dictionary has grown from
32 KB to 1.4 MB and is now included as part of the codespell library.
As the dictionary is readily available on the system, we will now use
it directly for spell checks. This offers several benefits:

1. Automatically use the latest dictionary whenever the codespell
library is updated.
2. Reduce maintenance overhead and avoid data duplication.

In the future, if we need to add a word that is specific to OpenBMC, we
can create a new dictionary file with just those entries and run a
separate codespell check using that file.

Change-Id: I2897ab159e0a6c14480e1ee2593761ab550a19e9
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>

show more ...


# a6ebc6e2 17-Jun-2024 Manojkiran Eda <manojkiran.eda@gmail.com>

Fix spelling mistakes using codespell

This commit corrects various spelling mistakes throughout the
repository. The corrections were made automatically using `codespell`[1]
tool.

[1]: https://githu

Fix spelling mistakes using codespell

This commit corrects various spelling mistakes throughout the
repository. The corrections were made automatically using `codespell`[1]
tool.

[1]: https://github.com/codespell-project/codespell

Change-Id: Ia6b70713d3e9b77d6fd2d9400489ef7f02360364
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>

show more ...


# 1d5e00de 11-Jan-2024 Jonathan Doman <jonathan.doman@intel.com>

format-code: don't spellcheck the commit author's name

Use the git-log --format option to only dump the "raw body (unwrapped
subject and body)", and omit the "commit"/"Author:"/"Date:" lines which
c

format-code: don't spellcheck the commit author's name

Use the git-log --format option to only dump the "raw body (unwrapped
subject and body)", and omit the "commit"/"Author:"/"Date:" lines which
can trigger false positives.

Tested: `format-code.sh --enable commit_spelling` doesn't reject my
commits :)

Change-Id: Ic03c1c9703a91dab9f268f5f7bbca29cabeeb067
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>

show more ...


# 910732cd 02-Jan-2024 Ed Tanous <ed@tanous.net>

Run commit checkers in CI

71b73249a30d589c97e15b387d4a18e8e6b795a9 Made the change that
format-code is only run on repos that have the appropriate files.
Because commit messages don't have a "file"

Run commit checkers in CI

71b73249a30d589c97e15b387d4a18e8e6b795a9 Made the change that
format-code is only run on repos that have the appropriate files.
Because commit messages don't have a "file" in the normal sense,
.git/COMMIT_EDITMSG was used instead. While this buffer file contains
the last commit message that was written, it only works on repos that
have had a commit done on them. For developers, this gives the expected
result, where commit message tools are run. For CI, where the repos
never had a commit message interaction, this leads to the commit message
runners never being run.

This commit moves the file check to .git (ie, that this is a git repo)
which should match everything. This was arguably better than adding a
"run all the time" mechanism specific to commit messages.

Tested:
Removing .git/COMMIT_EDITMSG on master and running a build shows commit
checks not run when run against master.

Running format-code.sh against this patch now shows commit tools run in
all cases.

Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: Ia596689b2ba220fc1dd17b713143ffc3fc96364f

show more ...


# 0b1b8ecb 25-Dec-2023 Patrick Williams <patrick@stwcx.xyz>

format-code: revert inadvertent changes

This partially reverts commit 2612b36b4cdeeb143b6d2cc9ef14dfc84f492ba5.

Some changes got merged in unintentionally that disabled big portions of
the format t

format-code: revert inadvertent changes

This partially reverts commit 2612b36b4cdeeb143b6d2cc9ef14dfc84f492ba5.

Some changes got merged in unintentionally that disabled big portions of
the format tool. Reset those back to the previous state.

Change-Id: I47f0094ecec0ed670944736fe8f56a4084594d07

show more ...


# 2612b36b 21-Dec-2023 Andrew Jeffery <andrew@aj.id.au>

OWNERS: Update Andrew's preferred email

We're having some grief with non-preferred emails in Gerrit[1]. I now
prefer project-related content goes to my work email address, so use my
non-preferred em

OWNERS: Update Andrew's preferred email

We're having some grief with non-preferred emails in Gerrit[1]. I now
prefer project-related content goes to my work email address, so use my
non-preferred email to implement the switch.

[1]: https://issues.gerritcodereview.com/issues/317345953

Change-Id: I1e17c560fd170304229c634f560dec59528e6e41
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# f0584408 11-Jul-2023 Patrick Williams <patrick@stwcx.xyz>

format-code: resolve symlinks in linter arguments

The latest version of prettier does not like being passed symbolic
links as arguments and refuses to follow the symlink. Add a call to
`realpath` w

format-code: resolve symlinks in linter arguments

The latest version of prettier does not like being passed symbolic
links as arguments and refuses to follow the symlink. Add a call to
`realpath` when we find all the lint-able files in order to resolve
the symlinks.

Tested:

The following error goes away:
```
[error] Explicitly specified pattern ".prettierrc.yaml" is a symbolic link.
[error] Explicitly specified pattern ".markdownlint.yaml" is a symbolic link.
```

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I18bac3e86253601140f034dc1b11f178443b6ed9

show more ...


# 45b21528 14-Feb-2023 Patrick Williams <patrick@stwcx.xyz>

black: remove --preview

The --preview option is more likely to cause churn in our Python
formatting. Disable it.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I96e6e7fbd6607c478ca

black: remove --preview

The --preview option is more likely to cause churn in our Python
formatting. Disable it.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I96e6e7fbd6607c478ca38c5de8a0db0c30b180a5

show more ...


# 7d41f6d2 06-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: enable markdownlint

Enable markdownlint but allow it to always pass. This will allow
maintainers the opportunity to run the tools and fix up their own
markdown before we enable this gl

format-code: enable markdownlint

Enable markdownlint but allow it to always pass. This will allow
maintainers the opportunity to run the tools and fix up their own
markdown before we enable this globally.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie397a72ca4ef113cdbe433d263ccf3bd5063cf4b

show more ...


# e795dfe4 06-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: enable black/isort

* black is a widely used python formatting tool.
* isort is used to order python imports in a consistent way.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

format-code: enable black/isort

* black is a widely used python formatting tool.
* isort is used to order python imports in a consistent way.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I1918421120ce2942f04b9110a2c0f1bd820d21c7

show more ...


# c5969599 06-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: enable beautysh

beautysh is a code formatter for bash/sh/zsh.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I0ebd5da9e78d84a98940fb3e6618b12cf8eb0fc7


# b08ddf77 06-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: enable prettier

prettier is a formatter for YAML, JSON, Markdown, etc.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I7a47d02ef7382d811423b97a88132aa92b991eed


# e0df3058 05-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: enable shellcheck everywhere

I have contributed fixes (or linter ignores) to all repositories
so that shellcheck passes. Enable it everywhere.

Signed-off-by: Patrick Williams <patrick

format-code: enable shellcheck everywhere

I have contributed fixes (or linter ignores) to all repositories
so that shellcheck passes. Enable it everywhere.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I1b771d9492f2ba3665e84e59beabee33dcc96f6f

show more ...


# c5ad7ff4 05-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: enable flake8 instead of pycodestyle

flake8 is a more complete python linter than pycodestyle
as it contains pycodestyle, pyflakes and mccabe. I have
contributed fixes to all repositor

format-code: enable flake8 instead of pycodestyle

flake8 is a more complete python linter than pycodestyle
as it contains pycodestyle, pyflakes and mccabe. I have
contributed fixes to all repositories so that flake8 passes,
so switch from pycodestyle to flake8 and enable everywhere.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I93867773830d476809364f44ad78104241d66a2a

show more ...


# 5095cbe9 08-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: detect tcl files

openbmc-test-automation has a few tcl files which are incorrectly
identified as bash by the `file` utility. Explicitly catch this
extension and classify as 'tcl' even

format-code: detect tcl files

openbmc-test-automation has a few tcl files which are incorrectly
identified as bash by the `file` utility. Explicitly catch this
extension and classify as 'tcl' even though we don't have a linter
for that language.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I2bb45b21398819d6a73cfa99aa1b5ef5f4bed164

show more ...


# 816c7cc1 08-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: option to explicitly enable linters

Sometimes it is useful to explicitly enable a single (or set of)
linters. Add an option (`--enable <tool>`) such that if any enable
is set then only

format-code: option to explicitly enable linters

Sometimes it is useful to explicitly enable a single (or set of)
linters. Add an option (`--enable <tool>`) such that if any enable
is set then only those linters will be utilized.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I49e4b760217e6a0df5c16275c466958b3a2422b3

show more ...


# d5d63950 07-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: handle incorrect 'env python3'

I noticed the `tools/owners` file was not getting the linters ran
correctly and upon investigation I found that it had the wrong path
for env, which cause

format-code: handle incorrect 'env python3'

I noticed the `tools/owners` file was not getting the linters ran
correctly and upon investigation I found that it had the wrong path
for env, which caused `file` to give incorrect results.

Fix the path in tools/owners, reformat and fix linter issues, and
ensure the scripts can handle python3 scripts with the wrong env
path.

I checked the codebase and there was only one other script, which
happens to reside in openbmc/openbmc, which used this incorrect
path. Therefore this change should have no effect on existing
repositories.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ice9703afbf104e3529f2c1b29ba8ba680eb07d94

show more ...


# 617a3f29 07-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: pycodestyle: add some compatibility for black/flake8

Black has some formatting defaults that disagree with pycodestyle.
Add options to pycodestyle to disable all default-disabled checks

format-code: pycodestyle: add some compatibility for black/flake8

Black has some formatting defaults that disagree with pycodestyle.
Add options to pycodestyle to disable all default-disabled checks
plus two that are incompatible with black. This allows commits to get
in to other repos in preparation for black/flake8 roll-out.

When we switch to black/flake8 these two extras will also be disabled
in flake8.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I86b4e2d21c7a89c40b98aadc3074a554201af93d

show more ...


# 476a7e99 06-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format shell scripts with beautysh

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie72911e0f57a1f69b0bf317de8c52947886e1303


# 200ec183 06-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: handle all files are ignored by linter

If all the files applicable to a linter have been ignored, then
we should not call the linter since many executables fail if no
source files are g

format-code: handle all files are ignored by linter

If all the files applicable to a linter have been ignored, then
we should not call the linter since many executables fail if no
source files are given as arguments.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I014291d807b2ef6be7ec3c5a5d3e7a4ce1de3717

show more ...


# 785327a7 05-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: run all linters before exit

Rather than stop on the first linter that fails, run them all and
collect the results. Show a summary of all the failing linters
at the end.

Signed-off-by:

format-code: run all linters before exit

Rather than stop on the first linter that fails, run them all and
collect the results. Show a summary of all the failing linters
at the end.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I6cb7d67c72025ed9e755c35b64bd43a82f066309

show more ...


# 26d9d2c5 05-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: halt on missing linter

From a CI perspective, we want to halt if any of the tools are missing
from the docker image, as a sanity check that we did not mess that up.
Add an option (--all

format-code: halt on missing linter

From a CI perspective, we want to halt if any of the tools are missing
from the docker image, as a sanity check that we did not mess that up.
Add an option (--allow-missing) that will simply warn and continue if
any linters are missing, but halt by default.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I1e39fcf80512f86679a2352a5eb29155df08162f

show more ...


# 3d29494c 05-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: document current linter-config hashes

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Idbfe0ef20b156e75a28986035c12df97577dfd65


# 147f37ad 04-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: add option to disable linter

Add an option that allows users to disable a linter. This
is useful when the repository currently has code that is failing
a linter (like gitlint) but you

format-code: add option to disable linter

Add an option that allows users to disable a linter. This
is useful when the repository currently has code that is failing
a linter (like gitlint) but you don't want the script to halt.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9bcfba475e1783e3763e45e4191728824b1ab166

show more ...


123