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

检查mybatis mapper xml文件代码,没有check出不符合规范的代码 #24

Open
trechina-yuanmingyin opened this issue Jul 22, 2020 · 1 comment

Comments

@trechina-yuanmingyin
Copy link

trechina-yuanmingyin commented Jul 22, 2020

手动安装
该插件可以从 github release 下载。

将下载的 jar 放到 $SONARQUBE_HOME/extensions/plugins 目录,并移除该插件的旧版本。

一旦完成,您将需要重新启动 SonarQube 服务器。

如何使用?
使用 maven 构建命令的示例如下:

mvn clean compile -U -Dmaven.test.skip=true -Dmaven.javadoc.skip=true sonar:sonar -Dsonar.host.url=http://127.0.0.1:9000/ -Dsonar.projectKey=demo -Dsonar.projectName=demo -Dsonar.sourceEncoding=UTF-8 -Dsonar.sources=. -Dsonar.inclusions=src/main/** -Dsonar.exclusions==src/main/webapp/**

要想分析 mybatis mapper 文件, src/main/resources 目录必须在 sonar.sources 中。

按以上步骤,检查mybatis mapper xml文件代码,没有check出不符合规范的文件及语句,部分代码如下:

xml文件在 src/mian/

<delete id="deleteSqlData">
        DELETE FROM table_name
        WHERE 1=1
        <if test="startTime != null">
            AND start_time <![CDATA[=]]> #{startTime}
        </if>
        <if test="endTime != null">
            AND end_time <![CDATA[=]]> #{endTime}
        </if>

    </delete>

    <select id="selectPgData" resultMap="BaseResultMap">
        select * from  dbkintai.mstemployeebasic limit 10;
    </select>
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.65. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

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

No branches or pull requests

1 participant