docs/style.md
Logisim-evolution uses Google Java Style code style as provided with the Checkstyle
static analyzer tool, with a few checks disabled as specified in the checkstyle-suppressions.xml
config file located in project root directory (from where it should be automatically picked
by Checkstyle).
As we use a suppression config file, you can set up IntelliJ's Checkstyle plugin in
two ways: one adds our suppressions to the built-in "Google Checks" config, the other
creates a completely new config using a copy from the Checkstyle source archive.
Either way, you need to install the CheckStyle-IDEA plugin first:
Settings -> Plugins.Edit the existing Google Checks configuration:
Tools -> Checkstyle plugin settings.Google Checks configuration.checkstyle-suppressions.xml config file. It
lives in the project's root directory and should be picked up automatically. It should not be
necessary to do anything else with it for it to be used.Checkstyle command or directly from the CheckStyle tab.Rules:, shown in the scan result window, reads Google Checks.You can configure InteliJ's CheckStyle plugin to behave exactly as we configure it:
Tools -> Checkstyle plugin settings.Checkstyle version to your liking.Checkstyle version and download the source archive.src/main/resources/google_checks.xml file to project root directory.+ icon.Logisim-evolution.Use a local Checkstyle file.Browse and point to the google_checks.xml file.Store relative to project location and click Next.checkstyle-suppressions.xml config file. It
lives in the project's root directory and should be picked up automatically. It should not be
necessary to do anything else with it for it to be used. If for any reason you need that changed,
edit configuration and look for a property named org.checkstyle.google.suppressionfilter.config,
then set its value to checksyle-suppressions.xml and click `Next.Checkstyle command or directly from the CheckStyle tab.Rules:, shown in the scan result window, reads Logisim-evolution.Checkstyle is also plugged into the project's Gradle build system and provides the checkstyleMain
and checkstyleTest tasks:
$ ./gradlew checkstyleMain
This should kick in automatically for some build tasks but if for any reason you want Checkstyle
to not be run during your builds, exclude these tasks with -x, i.e:
$ ./gradlew build -x checkstyleMain -x checkstyleTest
To improve quality of your commit, it's recommended to use pre-commit hooks, that will block
your commits unless all pre-commit tests pass. Logisim-evolution comes with predefined .pre-commit-config.yaml
config file for your convenience.
Brief installation instruction (see pre-commit official installation docs too):
pip install pre-commitcp .pre-commit-config.yaml.dist .pre-commit-config.yamlpre-commit installNot all hooks are perfect, so sometimes you may need to skip execution of one or more (or even all) hooks.
pre-commit solves this in two ways. To disable pre-commit completely, pass --no-verify to git:
$ git commit -a --no-verify
Alternatively, you may disable specific hooks only by using a SKIP environment variable, that is holds a comma separated
list of hook IDs to be omitted:
$ SKIP=checkstyle-jar git commit -a -m "Some changes"
Please remember to keep used hooks up to date, by periodically running
$ pre-commit autoupdate