Lint kotlin in a commit
Today, I encounter a problem, the problem is the kotlin files in a commit, but committed without pre-commit check, and I want to check the…
Today, I encounter a problem, the problem is the kotlin files in a commit, but committed without pre-commit check, and I want to check the kotlin files in this commit again.
The solution is that:
- get the changed files
- check the files with ktlint
Get changed files in a commit
Get the commit id with git log
, for example, the id is: 653a5ea6086865a8bfd90c3e7055f339d24605d3
Then we can use the following command to get the kotlin files in that commit.
Check the files with ktlint
Just added xargs ktlint
to check the files with ktlint
, the command is like below: