All Projects → alexkohler → Cfmt

alexkohler / Cfmt

Licence: mit
cfmt is a tool to wrap Go comments over a certain length to a new line.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Cfmt

Prealloc
prealloc is a Go static analysis tool to find slice declarations that could potentially be preallocated.
Stars: ✭ 419 (+1396.43%)
Mutual labels:  static-analysis, static-code-analysis, static-analyzer
phpstan-nette
Nette Framework class reflection extension for PHPStan & framework-specific rules
Stars: ✭ 87 (+210.71%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Dg
[LLVM Static Slicer] Various program analyses, construction of dependence graphs and program slicing of LLVM bitcode.
Stars: ✭ 242 (+764.29%)
Mutual labels:  static-analysis, static-code-analysis, static-analyzer
Phpinspectionsea
A Static Code Analyzer for PHP (a PhpStorm/Idea Plugin)
Stars: ✭ 1,211 (+4225%)
Mutual labels:  static-analysis, static-code-analysis, static-analyzer
Sonarjs
SonarSource Static Analyzer for JavaScript and TypeScript
Stars: ✭ 696 (+2385.71%)
Mutual labels:  static-analysis, static-code-analysis, static-analyzer
Phpstan Doctrine
Doctrine extensions for PHPStan
Stars: ✭ 338 (+1107.14%)
Mutual labels:  static-analysis, static-code-analysis, static-analyzer
Sonar Dotnet
Code analyzer for C# and VB.NET projects https://redirect.sonarsource.com/plugins/vbnet.html
Stars: ✭ 466 (+1564.29%)
Mutual labels:  static-analysis, static-code-analysis, static-analyzer
Phpstan
PHP Static Analysis Tool - discover bugs in your code without running it!
Stars: ✭ 10,534 (+37521.43%)
Mutual labels:  static-analysis, static-code-analysis, static-analyzer
identypo
identypo is a Go static analysis tool to find typos in identifiers (functions, function calls, variables, constants, type declarations, packages, labels).
Stars: ✭ 26 (-7.14%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
unimport
unimport is a Go static analysis tool to find unnecessary import aliases.
Stars: ✭ 64 (+128.57%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Sonar Java
☕️ SonarSource Static Analyzer for Java Code Quality and Security
Stars: ✭ 745 (+2560.71%)
Mutual labels:  static-analysis, static-code-analysis, static-analyzer
eba
EBA is a static bug finder for C.
Stars: ✭ 14 (-50%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (-50%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
sonarlint4netbeans
SonarLint integration for Apache Netbeans
Stars: ✭ 23 (-17.86%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
nakedret
nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length.
Stars: ✭ 82 (+192.86%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Phpdoc Parser
Next-gen phpDoc parser with support for intersection types and generics
Stars: ✭ 569 (+1932.14%)
Mutual labels:  static-analysis, static-code-analysis, static-analyzer
Phpstan Symfony
Symfony extension for PHPStan
Stars: ✭ 360 (+1185.71%)
Mutual labels:  static-analysis, static-code-analysis
Dss
📄 Documented Style Sheets Parser
Stars: ✭ 375 (+1239.29%)
Mutual labels:  static-analysis, comments
Engine
Droidefense: Advance Android Malware Analysis Framework
Stars: ✭ 386 (+1278.57%)
Mutual labels:  static-analysis, static-code-analysis
Wala
T.J. Watson Libraries for Analysis
Stars: ✭ 395 (+1310.71%)
Mutual labels:  static-analysis, static-code-analysis

cfmt

cfmt is a tool to wrap Go comments over a certain length to a new line.

Installation

go get -u github.com/alexkohler/cfmt

Note: cfmt requires gofmt.

Usage

Similar to other Go static anaylsis tools (such as golint, go vet), cfmt can be invoked with one or more filenames, directories, or packages named by its import path. cfmt also supports the ... wildcard.

cfmt [flags] files/directories/packages

Flags

  • -m - Maximum comment length before cfmt should insert a line break. (Default 80)
  • -w - Writes changes to file. By default, cfmt will only print the changes it will make, but will not modify the input files.

Examples

cfmt will wrap to a new line or join an existing line as appropriate. See the following before/afters of running cfmt -m=100:

Before

// I am a long comment that is over 100 characters long. I should probably wrap to a new line.

After

// I am a long comment that is over 100 characters long. I should probably wrap
// to a new line.

Before

// I am a long comment that is over 100 characters long. I should probably wrap below to the
// rest of the comment.

After

// I am a long comment that is over 100 characters long. I should probably wrap
// below to the rest of the comment.

Before

//I am a long comment that starts without a space and is over 100 characters long. When I wrap, I should still start without a space

After

//I am a long comment that starts without a space and is over 100 characters
//long. When I wrap, I should still start without a space

cfmt ignores block (/* */) comments and "grouped" comments over a length of 10 (i.e. 10+ consecutive lines starting with //).

Contributing

Pull requests welcome!

Other static analysis tools

If you've enjoyed cfmt, take a look at my other static anaylsis tools!

  • nakedret - Finds naked returns.
  • unimport - Finds unnecessary import aliases.
  • prealloc - Finds slice declarations that could potentially be preallocated.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].