Git Product home page Git Product logo

devreplay's Introduction

Devreplay

Devreplay is static analysis tool based on your own programming pattern.

How to use

  1. Install on local
$ npm install devreplay
# or
$ yarn global add 
  1. Put your own programming pattern(devreplay.json) on the project like bellow
[
  {
    "before": [
      "tmp = $1",
      "$1 = $2",
      "$2 = tmp"
    ],
    "after": [
      "$1, $2 = $2, $1"
    ]
  }
]
  1. Run the devreplay
$ devreplay yourfile.py
W:yourfile.py:15:$3 = $1$1 = $2$2 = $3 should be $2, $1 = $1, $2

or get fixed code

$ devreplay --fix yourfile.py

The target source code file will be

- tmp = a
- a = b
- b = a
+ a, b = b, a
  • Step up: Make the pattern message and severity. Also after can be more abstract
[
  {
    "before": [
      "$3 = $1",
      "$1 = $2",
      "$2 = $3"
    ],
    "after": [
      "$1, $2 = $2, $1"
    ],
    "author": "Yuki Ueda",
    "message": "Value exchanging can be one line",
    "severity": "Information"
  }
]
  • Recommend: Also you can generate pattern file automatically by following command on your git repository
devreplay --init
  • severity means how this pattern is important

    • E: Error
    • W: Warning
    • I: Information
    • H: Hint
  • Run devreplay again

$ devreplay yourfile.py
I:yourfile.py:15:Value exchanging can be one line by Yuki Ueda

Also, you can use default rules by extends some rules such as

[
  {
    "extends": ["typescript", "react", "vscode"]
  }
]

Make patterns by using Regular Expression

{
  "before": [
    "([a-z]+)-([a-z]+)"
  ],
  "after": [
      "$1 $2"
  ],
  "regex": true
}

That will fix

- print("hello-world")
+ print("hello world")

Default rule languages

  • c
  • cpp
  • dart
  • cobol
  • java
  • javaScript
  • typeScript
  • python
  • ruby
  • go
  • php

Defaulr rule frameworks

  • Angular
  • chainer2pytouch
  • tensorflow
  • rails
  • vue

Contribution Link

Thanks

This package is made based on

DevReplay is supported by 2019 Exploratory IT Human Resources Project The MITOU Program, JSPS KAKENHI Grant Numbers JP17H00731, JP15H02683, JP18H03221, and JP18KT0013.

License

MIT © 2019 Yuki Ueda [email protected] (ikuyadeu.github.io)

devreplay's People

Contributors

ikuyadeu avatar mrsekut avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.