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だと言われているオブジェクトスライスに対策する #1576

Merged

Conversation

berryzplus
Copy link
Contributor

PR の目的

カテゴリ

  • リファクタリング

PR の背景

前回の対策(#1554)がうまくいかなかったので再考しました。

PR のメリット

SonarCloudのBugsレベル警告が1つ解消します。

PR のデメリット (トレードオフとかあれば)

とくにありません。

仕様・動作説明

オブジェクトスライスが発生している、というのに対策します。

Use pointer or reference to avoid slicing from "CLogicPointEx" to "CStrictPoint<SLogicPoint, CStrictInteger<0, true, true, true, true>, CStrictInteger<0, true, true, true, true>>".
https://sonarcloud.io/project/issues?id=sakura-editor_sakura&issues=AXTfn5C0o25dCGZTbT9Y&open=AXTfn5C0o25dCGZTbT9Y

前回 std::move しましたが、static_castするように変更します。

PR の影響範囲

テスト内容

修正内容は動作に影響をあたえません。

このPRをマージした状態のブランチでSonarScanして、Bugsレベル警告が解消することを確認しました。
https://github.com/berryzplus/sakura/runs/2051423177

関連 issue, PR

#1554
#1504

参考資料

前回の対策がうまくいかなかったので再考。
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@AppVeyorBot
Copy link

Copy link
Member

@kengoide kengoide left a comment

Choose a reason for hiding this comment

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

ムーブが悪くてキャストが良いとは不可解に思えますが、それはそれとして承認させていただきます。

@berryzplus
Copy link
Contributor Author

レビューありがとうございます。マージしちゃいます。

@berryzplus berryzplus merged commit e5a2d83 into sakura-editor:master Mar 10, 2021
@berryzplus berryzplus deleted the feature/avoid_slice_take2 branch March 10, 2021 17:18
@beru beru added the refactoring リファクタリング 【ChangeLog除外】 label Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring リファクタリング 【ChangeLog除外】
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants