sonar-next / sonar-swift

sonar-swift.SonarQube iOS Plugin, Support Objective-C/Swift/Java, Support import Infer Issue (SonarQube iOS 代码扫描插件,支持 Objective-C 和 Swift / Java,支持 Infer 结果导入 ) base on https://github.com/Idean/sonar-swift
Other
221 stars 39 forks source link

WARN: file not included in sonar /Users/Shared/work #21

Open wyw1984 opened 2 years ago

wyw1984 commented 2 years ago
截屏2022-02-17 上午11 17 53

您好,当工程中有Pods文件时会报如图的警告 WARN: file not included in sonar /Users/Shared/work

sonarqube里也没有任何bug和异味,组件化后,我们的代码都在pods里,这个怎么解决呢?

sydowma commented 2 years ago
  1. 你要扫描的是 swift 语言?
  2. 贴一下执行 swiftlint 的命令
  3. 贴一下 执行扫描的命令
wyw1984 commented 2 years ago

1.是oc和swift混编 2.命令如下

!/bin/bash

pod update

xcodebuild clean -workspace MyApp.xcworkspace -scheme MyApp -arch arm64 -configuration "Release"

xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -arch arm64 -configuration "Release" GCC_PREPROCESSOR_DEFINITIONS="COCOAPODS=1" CODE_SIGN_STYLE="Manual" PROVISIONING_STYLE="Manual" DEVELOPMENT_TEAM="xxx" CODE_SIGN_IDENTITY="xxx" PROVISIONING_PROFILE="xxx" PROVISIONING_PROFILE_SPECIFIER="xxx" | xcpretty -r json-compilation-database -o compile_commands.json

rm -rf swiftlint

mkdir swiftlint

swiftlint lint > swiftlint/swiftlint.txt

sonar-scanner -Dsonar.host.url=http://10.155.59.201:9000/ -Dsonar.projectKey=MyApp -Dsonar.sources=. -Dsonar.swift.swiftlint.report=swiftlint/swiftlint.txt -Dsonar.login=admin -Dsonar.password=111111

wyw1984 commented 2 years ago

xcodebuild是成功了的,为了保密打包证书都替换成了xxx , 如果只是swift语言 好像不用执行xcodebuild也一样能扫描 不过还是报同样的WARN: file not included in sonar

sydowma commented 2 years ago
  1. 如果只扫描 swift 不用执行 xcodebuild
  2. 如果需要扫描 OC ,请提前执行下 infer ,参考下文档的命令。
  3. 从你的结果来看,像是路径问题,你把 swiftlint.txt 放在当前目录下试试,去掉 swiftlint 这一层
wyw1984 commented 2 years ago

去掉了也不行,还是报WARN: file not included in sonar

sydowma commented 2 years ago

去掉了也不行,还是报WARN: file not included in sonar

执行 sonar-scanner 里加一个 -X,然后发一下 WARN: file not included in sonar 这个详细日志

wyw1984 commented 2 years ago

log.txt 您好 这是sonar-scanner 里加一个 -X后 jenkins上的log

fndppx commented 2 years ago

log.txt 您好 这是sonar-scanner 里加一个 -X后 jenkins上的log

解决了么,我也遇到这个问题了

wuyanzu1-wyz commented 1 year ago

hello,我也遇到了和楼主一样的问题,也是没有任何bug和异味,也出现了图中的警告,请问楼主解决了吗?是如何解决的?