USER GUIDE

Installation and Usage

If you will use on command line interface

npm install -g devreplay
# or
yarn global add devreplay

Fix the your source file.

devreplay --fix yourfile.py > yourfile.py
- tmp = a
- a = b
- b = a
+ a, b = b, a

Configuration

You should then make a devreplay.json file. Here is the example.

[
  {
    "before": [
      "$3 = $1",
      "$1 = $2",
      "$2 = $3"
    ],
    "after": [
      "$1, $2 = $2, $1"
    ],
    "author": "Yuki Ueda",
    "message": "Value exchanging can be one line",
    "severity": "Information"
  }
]
  • before: Before changed code snippet you can write more concrete like here
    "before": [
      "tmp = a",
      "a = b",
      "b = tmp"
    ],
    
  • before: After changed code snippet you can write more concrete like here
    "before": [
      "a, b = b, a"
    ],
    
  • author: Creator of rules or source for reliability
  • message: Details of rules importaces (default: before should be after)
  • severity: How this pattern is important
    • E: Error
    • W: Warning
    • I: Information
    • H: Hint

You can extends your devreplay.json from built-in rules and your local rules.

[
  {
      "extends": [
          "typescript",
          "React",
          "/your/local/rules.json"
      ]
  },
  {
    "before": [
      "$3 = $1",
      "$1 = $2",
      "$2 = $3"
    ],
    "after": [
      "$1, $2 = $2, $1"
    ]
  }
]

Auto Rule Learning

On the git repository following command generate recent changes rule

devreplay --init