Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add TeamCity output format #3606

Merged
merged 13 commits into from
Feb 27, 2023
Merged

Conversation

ferhatelmas
Copy link
Contributor

fixes #3597

@ferhatelmas ferhatelmas force-pushed the teamcity-output branch 2 times, most recently from b48e731 to cd2f633 Compare February 17, 2023 15:11
@ldez ldez added enhancement New feature or improvement area: output Related to issue output labels Feb 17, 2023
pkg/config/output.go Outdated Show resolved Hide resolved
pkg/printers/teamcity.go Outdated Show resolved Hide resolved
pkg/printers/teamcity.go Outdated Show resolved Hide resolved
@alexandear alexandear changed the title feat: add team city output format feat: add TeamCity output format Feb 20, 2023
@ldez ldez added the feedback required Requires additional feedback label Feb 22, 2023
@ldez ldez removed the feedback required Requires additional feedback label Feb 25, 2023
pkg/printers/teamcity.go Outdated Show resolved Hide resolved
ferhatelmas and others added 2 commits February 27, 2023 14:35
Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ldez ldez requested a review from alexandear February 27, 2023 14:22
@alexandear
Copy link
Member

Did you test these changes on a TeamCity server?

I did. And it doesn't work. My steps:

  1. Created a free TeamCity Cloud instance
  2. Set a new project with build configuration which:
  • build golangci-lint binary in this branch:
cd test
make -C ".." build
  • runs golangci-lint inside test/testdata directory with --out-format=team-city:
LINTERS=("govet" "errcheck" "staticcheck" "unused" "gosimple" "ineffassign" "asasalint" "wrapcheck" "nilerr" "nlreturn" "gosec")

cat > severity.yaml << EOF
severity:
  default-severity: info
  rules:
    - linters:
        - govet
      severity: warning
    - linters:
        - unused
      severity: error
    - linters:
        - gosimple
      severity: weak warning
EOF

for i in "${!LINTERS[@]}"
do
   LINTER="${LINTERS[$i]}"
   ./../../golangci-lint run --go=1.17 --config=severity.yaml --allow-parallel-runners --disable-all --max-same-issues=100 --out-format=team-city -Etypecheck -E"$LINTER" "$LINTER.go"
done

Output: "Code Inspection" tab is empty.
image

You could view this directly on the TeamCity (use "Log in as guest").

Changes:
- print SEVERITY;
- populate inspectionType from linter's Name and Desc;
- test escaping;
- extend .golangci.reference.yml with TeamCity;
- minor documentation fixes.
@alexandear
Copy link
Member

alexandear commented Feb 27, 2023

So, I pushed the commit f40b25d with fixes.

Changes:

  • print SEVERITY instead of additional attribute;
  • populate inspectionType from linter's Name and Desc;
  • test escaping characters;
  • unexport inspectionType and inspectionInstance;
  • extend .golangci.reference.yml severity section with TeamCity;
  • minor documentation fixes.

And it now works:
image

See here (use "Log in as guest").

pkg/config/output.go Outdated Show resolved Hide resolved
@ldez
Copy link
Member

ldez commented Feb 27, 2023

Did you test these changes on a TeamCity server?
I did. And it doesn't work.

No, and this is why I asked you to test it and why I didn't merge before your review.

So, I pushed the commit with fixes.

I also asked you to not add commits to the PR.

@ldez ldez merged commit 075691c into golangci:master Feb 27, 2023
@ferhatelmas ferhatelmas deleted the teamcity-output branch February 27, 2023 21:31
@alexandear
Copy link
Member

I also asked you to not add commits to the PR.

Ok, will do that in future PRs. Sorry, I didn't see the comment. Maybe because it was resolved and GitHub doesn't send notifications in such cases.

SeigeC pushed a commit to SeigeC/golangci-lint that referenced this pull request Apr 4, 2023
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
@ldez ldez added this to the v1.52 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: output Related to issue output enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TeamCity Printer similar to GitHub
3 participants