Slither-format is a Slither utility tool which uses Slither detectors to identify code patterns of concern (w.r.t security, readability and optimisation) and automatically fix those code patterns with suggested changes.
Slither detectors highlight names, context and source-mapping of code constructs which are then used by Slither-format to programmatically locate those constructs in the Solidity files and then replace them with changes based on best practices. Lexical analysis for identification of such constructs is confined to the smallest possible region to avoid conflicts with similarly named constructs (with potentially different types or signatures) in other scopes, functions or contracts within the same file (because of shadowing, overloading etc.).
## Features
* Removes declarations of unused state variables
* Changes the visibility of `public` (explicit or implicit until solc 0.5.0) functions to `external` where possible
* Declares state variables as `constant` where possible
* Removes `pure`/`view`/`constant` attributes of functions when they are incorrectly used
* Replaces old/buggy/too-recent versions of `solc` with either `0.4.25` or `0.5.3`
* Replaces use of different `solc` versions with either `0.4.25` or `0.5.3`
* Replaces names of various program constructs to adhere to Solidity [naming convention](https://solidity.readthedocs.io/en/v0.4.25/style-guide.html#naming-conventions):
+ Contract names are converted to CapWords in contract definitions and uses
+ Structure names are converted to CapWords in structure declarations and uses
+ Event names are converted to CapWords in event declarations and calls
+ Enum names are converted to CapWords in enum declarations and uses
This produces a `constant.sol.format` file which has all the feature replacements. It also produces a `constant.sol.format.patch` file which is a `git` compatible patch file that can be used to apply format diffs to the original file.