Coder Social home page Coder Social logo

action-ktlint's People

Contributors

alsutton avatar aruke avatar berhram avatar dvdandroid avatar faogustavo avatar ghaiszaher avatar guil-camp-scacap avatar jpcrespi avatar juliansuttner avatar nbadal avatar renatoabreu11 avatar scalable-atlantis[bot] avatar vaind avatar zipizigi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

action-ktlint's Issues

no errors and vroy/gha-kotlin-linter shows about 3000+ on a repo

workflow defined as follows:

# This is a basic workflow to help you get started with Actions


name: reviewdog

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - uses: actions/checkout@v2
      
    - name: ktlint
      uses: ScaCap/action-ktlint@master
      with:
        github_token: ${{ secrets.github_token }}
        reporter: github-pr-review # Change reporter

    - name: Kotlin Linter
      uses: vroy/gha-kotlin-linter@v2

KTLint Action finishing with success event when has erros

I want to finish the job with and error if I found some error on lint, but, event with errors, the returning code is being successful.

I believe that the returning code from the script is from the "reviewdog" with a successful report.

image

Ktlint job fails on PRs with > 300 files.

About 2 months ago we updated to use ktlint version 1.1.1
Since last 2 weeks we've had a few cases with PRs having >300 files.
action-ktlint fails on these PRs with the following error excerpt.

2024-04-11T13:09:41.4432546Z ktlint version: 1.1.1
2024-04-11T13:13:25.4815816Z reviewdog: post failed for ktlint: fail to parse diff: GET https://api.github.com/repos/Org/my-repo/pulls/123: 406 Sorry, the diff exceeded the maximum number of files (300). Consider using 'List pull requests files' API or locally cloning the repository instead. [{Resource:PullRequest Field:diff Code:too_large Message:}]

Not sure if this is failing now due to v1.1.1 or some new Github API changes.

Reporter reports only one message

Hi!
I faced the problem that in output I have a lot of error messages but GitHub bot reports only one.
I'm expecting that if I have 50 ktlint errors it will see 50 PR comments.

Part of output:
Screenshot 2023-02-22 at 10 14 51

GA workflow:

name: Code Review Workflow
on: [pull_request]
jobs:
  ktlint:
    name: Check Code Style
    runs-on: [self-hosted, nonroot]

    steps:
      - uses: actions/checkout@v3
      - uses: ScaCap/action-ktlint@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-review
          fail_on_error: true
          filter_mode: file

Add reporter for comment on pull request

Hi,

I would like to propose a third mechanism of report: A comment that will be added by the GitHub action including the report that is currently available via github-pr-check.

This would make the report a bit more present than the additional GitHub Check, but would not be as intrusive/verbose as the github-pr-review is.

Suggestion for naming would be github-pr-comment

Error after get report

I have an issue like that. I read from references, that it must modify some rules. can I change it?

app/src/main/java/id/kompas/app/view/base/BaseAuthActivity.kt:1:1: error: File must end with a newline (\n) (final-newline) app/src/main/java/id/kompas/app/view/base/BaseAuthActivity.kt:3:1: error: Imports must be ordered in lexicographic order without any empty lines in-between with "java", "javax", "kotlin" and aliases in the end (import-ordering) app/src/main/java/id/kompas/app/view/base/BaseAuthEmailActivity.kt:1:1: error: File must end with a newline (\n) (final-newline) app/src/main/java/id/kompas/app/view/base/BaseAuthEmailPhoneActivity.kt:1:1: error: File must end with a newline (\n) (final-newline) app/src/main/java/id/kompas/app/view/base/BaseAuthEmailPhoneActivity.kt:3:1: error: Imports must be ordered in lexicographic order without any empty lines in-between with "java", "javax", "kotlin" and aliases in the end (import-ordering) app/src/main/java/id/kompas/app/view/base/BaseAuthIntentActivity.kt:1:1: error: File must end with a newline (\n) (final-newline)

`--code-style` argument will cause error

Summary

1.2.0 got released today, and CI is failing for us using latest.

ktlint version: ktlint version 1.2.0
Parameter '--code-style' is no longer valid. The code style should be defined as '.editorconfig' property 'ktlint_code_style='
reviewdog: parse error: EOF

Seems like this has been deprecated for a while now, so perhaps time to remove it?

Expected behavior

CI runs

Current behavior

ktlint will return an error without executing.

Any way to make ktlint report a failure but continue to lint the rest of the PR?

Hey there, I was trying to add this to my open source project. I'd like the ktlint job to run for new PRs and if an issue is detected I want an error to be reported so the PR cannot be merged. However, the issue with this is it seems the ktlint job stops running once it encounters an issue. Is there a way to make it continue to lint after it has found an issue? If a PR had multiple lint issues it would be better to get a report of all the issues rather than fixing them one commit at a time.

Fyi I had fail_on_error = true. If I set it to false then it seems to report all the ktlint issues.

Action does not work with latest (v1.2.0)

Version 1.2.0 has just been released.
When using the action with that version of ktlint, it fails with:

ktlint version: ktlint version 1.2.0
Parameter '--code-style' is no longer valid. The code style should be defined as '.editorconfig' property 'ktlint_code_style='
reviewdog: EOF

Tag a more recent release

Please consider tagging newer releases than the 1.3 that dates quite a while back - some orgs have internal policies that don't allow pulling from a @main or @master tag.

Add rule to the comment

Hi,

I can see that the action logs show the following:
kex-angebote-service/src/main/kotlin/de/europace/privatkredit/kex/angebote/TaskExecutorConfig.kt:23:1: error: Unexpected indentation (12) (should be 6) (indent)

When I look at the comment however the rule name is not shown:
image

Would be good if that was added into the comment

Running kt-lint on self-hosted

I have run reviewdog with fastlane on ubuntu-latest and it works perfect.

When I run it on self-hosted It gives me below error

image

This is my yml file

lintCheck:
    name: Lint Check
    runs-on: self-hosted
    steps:
      - name: checkout
        uses: actions/checkout@v2
      - name: Set up Ruby 2.6
        uses: actions/setup-ruby@v1
        with:
          ruby-version: 2.6.x
      - name: Install Dependencies
        run: gem install bundler && bundle install
      - name: Lint
        run: bundle exec fastlane lint
      - name: Run Android Lint
        uses: dvdandroid/action-android-lint@master
        with:
          github_token: ${{ secrets.TOKEN_GITHUB }}
          lint_xml_file: app/build/reports/lint-results.xml

Any Ideas what could be the reason?

Task fails even when no lint errors

it was working when i tested it with errors, it detects them and leaves comments

But even setting level: warning or level: info, it didn't fix it.

I have fail_on_error: true, but there were no errors to fail on? Logs don't provide much on the surface

Run ScaCap/[email protected]
  with:
    github_token: ***
    reporter: github-pr-review
    fail_on_error: true
    level: info
    relative: true
    android: false
/usr/bin/docker run --name d8a[2](https://github.com/CenturyLinkCloud/as-storagefabric-middle-tier/runs/6425000286?check_suite_focus=true#step:4:2)1abc4f6004[3](https://github.com/CenturyLinkCloud/as-storagefabric-middle-tier/runs/6425000286?check_suite_focus=true#step:4:3)a3a3a88da828d018[4](https://github.com/CenturyLinkCloud/as-storagefabric-middle-tier/runs/6425000286?check_suite_focus=true#step:4:4)4_f1816f --label 084[5](https://github.com/CenturyLinkCloud/as-storagefabric-middle-tier/runs/6425000286?check_suite_focus=true#step:4:5)0d --workdir /github/workspace --rm -e INPUT_GITHUB_TOKEN -e INPUT_REPORTER -e INPUT_FAIL_ON_ERROR -e INPUT_LEVEL -e INPUT_RELATIVE -e INPUT_ANDROID -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/as-storagefabric-middle-tier/as-storagefabric-middle-tier":"/github/workspace" 08450d:8a21abc4f[6](https://github.com/CenturyLinkCloud/as-storagefabric-middle-tier/runs/6425000286?check_suite_focus=true#step:4:6)0043a3a3a[8](https://github.com/CenturyLinkCloud/as-storagefabric-middle-tier/runs/6425000286?check_suite_focus=true#step:4:8)8da828d01844  "***" "info" "github-pr-review" "true" "true" "false"
KtLint version: 0.45.2

Build fails with " Error: Docker build failed with exit code 3 ".

Hi.

I have an issue like that:
Using the code in the README.md, I got the following error when running Actions.

  Step 5/7 : RUN wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION}
   ---> Running in 3b77dd471421
  reviewdog/reviewdog info checking GitHub for tag 'v0.14.1'
  reviewdog/reviewdog info found version:  <!DOCTYPE html> <html lang= for  <!DOCTYPE html> <html lang=/Linux/x86_64
  The command '/bin/ash -eo pipefail -c wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION}' returned a non-zero code: 3

Warning: Docker build failed with exit code 3, back off 5.742 seconds before retry.
...
Error: Docker build failed with exit code 3 

I'm sorry that my writing may be a little strange because I'm not a native English speaker.

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.