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

SonarCloudにBugだと言われているC++クラス定義に対策したい #1605

Closed
berryzplus opened this issue Mar 26, 2021 · 3 comments · Fixed by #1704
Closed

SonarCloudにBugだと言われているC++クラス定義に対策したい #1605

berryzplus opened this issue Mar 26, 2021 · 3 comments · Fixed by #1704

Comments

@berryzplus
Copy link
Contributor

問題内容

SonarCloudにより、C++クラス定義に関するBugs(Criticalレベル)警告が検出されています。

全部で80件が検出されており、警告の総数263件の3割を占めています。

再現手順

CIによる自動実行で毎回検出されています。
https://sonarcloud.io/project/issues?id=sakura-editor_sakura&resolved=false&severities=CRITICAL&types=BUG

クリーンな状態からSonarCloud解析を開始したレポジトリでは検出されない問題なので、なんらかの検出レベル調整を行った影響で不当に重い警告に昇格している可能性があります。

対策として考えられるのは3つくらい。

  1. 「警告レベルが不当である」を問題と考えて、SonarCloud設定を見直す。
  2. 「警告レベルが不当」なので、該当の警告を無視(fault positiveとマーク)する。
  3. 「指摘された問題」に、素直に対処する。

実態として「問題のあるコード」なのは間違いなさそうなので、実質的には 3 の一択かと思います。

再現頻度

100%

問題のカテゴリ

  • その他の問題
    (「コーディング作法」の問題)

環境情報

  • OS バージョン
  • サクラエディタバージョン
  • PC情報

スクリーンショット

@berryzplus
Copy link
Contributor Author

#1690#1691 をマージすると残りは 6件 になります。

残した 6件 は、単なるC++の定義的な問題(≒事実上「誤検知」みたいなやつ)ではなくて、本当に問題があって修正すべきだと思います。

なので、いま出てるPRをマージしたらこのissueは閉じてしまおうと思っています。

@sanomari
Copy link
Contributor

Criticalレベルの残4件のうち2件はrule of fiveで対応できそうに見えます。
https://sonarcloud.io/project/issues?id=sakura-editor_sakura&resolved=false&severities=CRITICAL&types=BUG

  • sakura_core/basis/CStrictRange.h
  • sakura_core/util/window.h

@berryzplus
Copy link
Contributor Author

Criticalレベルの残4件のうち2件はrule of fiveで対応できそうに見えます。
https://sonarcloud.io/project/issues?id=sakura-editor_sakura&resolved=false&severities=CRITICAL&types=BUG

  • sakura_core/basis/CStrictRange.h
  • sakura_core/util/window.h

確認してみました。
CStrictRangesのほうは対応できそうなのでPR作成します。
CFontAutoDeleterのほうは「実際に問題があるので対処できない」で、このissueの対象外でした。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants