All Projects → automutate → automutate

automutate / automutate

Licence: MIT License
Applies waves of mutations provided by other tools, such as linters or codemods.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to automutate

static-code-analysis-plugin
A plugin to simplify Static Code Analysis on Gradle. Not restricted to, but specially useful, in Android projects, by making sure all analysis can access the SDK classes.
Stars: ✭ 36 (+176.92%)
Mutual labels:  linter, static-analysis
mllint
`mllint` is a command-line utility to evaluate the technical quality of Python Machine Learning (ML) projects by means of static analysis of the project's repository.
Stars: ✭ 67 (+415.38%)
Mutual labels:  linter, static-analysis
sonar-css-plugin
SonarQube CSS / SCSS / Less Analyzer
Stars: ✭ 46 (+253.85%)
Mutual labels:  linter, static-analysis
ramllint
RAML Linter
Stars: ✭ 18 (+38.46%)
Mutual labels:  linter, static-analysis
golintui
A simple terminal UI for Go linters
Stars: ✭ 73 (+461.54%)
Mutual labels:  linter, static-analysis
go-perfguard
CPU-guided performance analyzer for Go
Stars: ✭ 58 (+346.15%)
Mutual labels:  linter, static-analysis
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Stars: ✭ 3,019 (+23123.08%)
Mutual labels:  linter, static-analysis
Revive
🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
Stars: ✭ 3,139 (+24046.15%)
Mutual labels:  linter, static-analysis
addlint
An example linter written with go/analysis for tutorial purposes
Stars: ✭ 49 (+276.92%)
Mutual labels:  linter, static-analysis
staticcheck-action
Staticcheck's official GitHub Action
Stars: ✭ 47 (+261.54%)
Mutual labels:  linter, static-analysis
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (+7.69%)
Mutual labels:  linter, static-analysis
codeclimate-eslint
Code Climate Engine for ESLint
Stars: ✭ 86 (+561.54%)
Mutual labels:  linter, static-analysis
dlint
Dlint is a tool for encouraging best coding practices and helping ensure Python code is secure.
Stars: ✭ 130 (+900%)
Mutual labels:  linter, static-analysis
pahout
A pair programming partner for writing better PHP. Pahout means PHP mahout 🐘
Stars: ✭ 43 (+230.77%)
Mutual labels:  linter, static-analysis
tryceratops
A linter to prevent exception handling antipatterns in Python (limited only for those who like dinosaurs).
Stars: ✭ 381 (+2830.77%)
Mutual labels:  linter, static-analysis
nestif
Detect deeply nested if statements in Go source code
Stars: ✭ 30 (+130.77%)
Mutual labels:  linter, static-analysis
Protoc Gen Lint
A plug-in for Google's Protocol Buffers (protobufs) compiler to lint .proto files for style violations.
Stars: ✭ 221 (+1600%)
Mutual labels:  linter, static-analysis
D Scanner
Swiss-army knife for D source code
Stars: ✭ 221 (+1600%)
Mutual labels:  linter, static-analysis
constyble
CSS complexity linter
Stars: ✭ 92 (+607.69%)
Mutual labels:  linter, static-analysis
sonar-gherkin-plugin
SonarQube Cucumber Gherkin Analyzer
Stars: ✭ 33 (+153.85%)
Mutual labels:  linter, static-analysis

automutate

Build Status npm

Applies waves of mutations provided by other tools, such as linters or codemods.

There are many linters out there and most include ways to --fix rule failures automatically. This is great but hard to do for a couple of reasons:

  • Overlapping mutations - The possibility of mutations applying to overlapping sets of characters requires logic to handle applying one, then re-running linting, and so on.
  • Code bloat verses duplication - Most linters either provide hooks to apply fixes themselves (which can result in code bloat) or have an external project (which duplicates logic for finding rules).

automutate proposes that linters only propose how to fix rules, via a standardized JSON format.

Having a standardized source-agnostic project to apply mutations brings a couple of benefits:

  • Reduced overhead - Projects no longer need to do this work themselves.
  • Standardized base - Ramp-up time to switch between projects using automutate is reduced with common code.

In general, detecting rule failures is a separate concern from fixing them. Linters need to run quickly over a read-only set of files, often during built processes, while fixers typically run slowly and modify files on user request.

How it works

The main automutate algorithm is started in autoMutator.ts and mostly applied in mutationsApplier.ts:

while mutationsWave = getMutationsWave():
    for (file, fileMutations) of groupMutationsByFile(mutationsWave):
        for mutation of getNonOverlappingMutationsInReverse(fileMutations):
            applyMutation(file, mutation)
  1. getMutationsWave calls to an external tool, such as a linter, to receive a wave of suggested mutations.
  2. groupMutationsByFile organizes the suggested mutations by file.
  3. getNonOverlappingMutationsInReverse removes overlapping mutations that would conflict with each other, and sorts the remainder in reverse order so that later mutations don't interfere with character positions of earlier mutations.
  4. applyMutation modifies files on disk using the remaining mutations.

Mutations

A single mutation contains a unique type identifier, a range of character position(s) to apply to, and optionally other logic.

The following basic text manipulations are provided out of the box:

  • multiple - Container for multiple mutations. This indicates to automutate that these must be applied all at once or not at all, which guarantees consistency with the built-in mutation overlap detection.
  • text-delete - Deletes a range of characters.
  • text-insert - Inserts a string at a point.
  • text-replace - Replaces characters matching a string or regular expression within a range.
  • text-swap - Swaps a range of characters with a new string.

For example:

{
  "ugly-file.txt": [
    {
      "range": {
        "begin": 7,
        "end": 14
      },
      "type": "text-delete"
    },
    {
      "insertion": "inconceivable!",
      "range": {
        "begin": 21
      },
      "type": "text-insert"
    }
  ]
}

Linter-specific utilities may define their own mutations. For example, a language's linter may define a node-rename mutation rather than use a multiple mutation containing text-swap mutations.

See Mutators for more on custom mutators.

Project Onboarding

See Onboarding.

automutate requires NodeJS >= 14.

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].