lint

Trouble with -Xlint:all and maven

空扰寡人 提交于 2019-12-04 14:04:49
问题 I'm trying to get maven to output lint level warnings. I've created a small test program that should generate a warning about using a static method from a non-static context, but despite a number of different plugin configuration options, the build always succeeds without any warnings! After doing some googling, I found suggestions to use the 'compilerArgument(s)' attribute of the compiler plugin, but this doesn't seem to be working for me either. Here's my sample program that should generate

How to set up catalog files for xmllint?

拈花ヽ惹草 提交于 2019-12-04 11:09:44
Ok. I want to set up catalog files for xmllint to fix things so that the dcterms xml namespace is validated from a local document. I believe that I have done everything right, but it simply doesn't seem to be working. I am running OSX. I have created a directory /etc/xml $ mkdir /etc/xml $ cd /etc/xml I have downloaded dcterms.xsd to that directory $ ls -l -rw-r--r-- 1 ibis wheel 12507 24 Jul 11:42 dcterms.xsd I have created a file named "catalog" $ xmlcatalog --create > catalog I have added the dcterms namespace to the catalog file $ xmlcatalog --noout --add uri http://purl.org/dc/elements/1

VS Code style-lint ignore directories

*爱你&永不变心* 提交于 2019-12-04 10:54:10
Is it possible to ignore my CSS path, beacuse I only use stylelint for SCSS validation? e.g. - I have the following structure: assets/ css/ scss/ How can I disable the css/ folder from being indexed, trough the settings.json file of VSCode? I found this in the docs , but I don't know how to implement it in VSCode. If you're using the VS Code stylelint extension, you can specify ignore paths via the stylelint.configOverrides setting. Add the following to your VS Code settings.json file: "stylelint.configOverrides": { "ignoreFiles": "assets/css/**" } Alternatively you can add a .stylelintignore

VS Code formatting for “{ }”

[亡魂溺海] 提交于 2019-12-04 07:46:07
问题 I'm on ubuntu. When I write C++ code in VS Code it automatically lints like if (condition == true) { DoStuff(); } instead I want to do like if (condition == true) { DoStuff(); } How do I do that? I've already installed C/C++ extension from marketplace. 回答1: base on @Chris Drew's answer Go Preferences -> Settings Search for C_Cpp.clang_format_fallbackStyle Click Edit, Copy to Settings Change from "Visual Studio" to "{ BasedOnStyle: Google, IndentWidth: 4 }" e.g. "C_Cpp.clang_format

Android ------ 美团的Lint代码检查实践

戏子无情 提交于 2019-12-04 06:24:50
概述 Lint是Google提供的Android静态代码检查工具,可以扫描并发现代码中潜在的问题,提醒开发人员及早修正,提高代码质量。除了Android原生提供的几百个Lint规则,还可以开发自定义Lint规则以满足实际需要。 为什么要使用Lint 在美团外卖Android App的迭代过程中,线上问题频繁发生。开发时很容易写出一些问题代码,例如Serializable的使用:实现了Serializable接口的类,如果其成员变量引用的对象没有实现Serializable接口,序列化时就会Crash。我们对一些常见问题的原因和解决方法做分析总结,并在开发人员组内或跟测试人员一起分享交流,帮助相关人员主动避免这些问题。 为了进一步减少问题发生,我们逐步完善了一些规范,包括制定代码规范,加强代码Review,完善测试流程等。但这些措施仍然存在各种不足,包括代码规范难以实施,沟通成本高,特别是开发人员变动频繁导致反复沟通等,因此其效果有限,相似问题仍然不时发生。另一方面,越来越多的总结、规范文档,对于组内新人也产生了不小的学习压力。 有没有办法从技术角度减少或减轻上述问题呢? 我们调研发现,静态代码检查是一个很好的思路。静态代码检查框架有很多种,例如FindBugs、PMD、Coverity,主要用于检查Java源文件或class文件;再例如Checkstyle,主要关注代码风格

How can I get ESLint to lint HTML files in VSCode?

好久不见. 提交于 2019-12-04 04:02:54
I have a Javascript browser project split over multiple files and can't get ESLint to lint the script tags of my HTML file under the same global scope so that declarations and calls of classes and functions in one file are recognised in another. Here is my project structure: This is the contents of foo.js: sayHello(); and bar.js: function sayHello() { console.log('Hello'); } And I have linked them both in the HTML file: <html> <head> <meta charset="UTF-8"> <link rel="stylesheet" href="main.css"> <script src="libraries/bar.js" type="text/javascript"></script> <script src="foo.js" type="text

Any Tools to Catch Silly Mistakes in C Code?

て烟熏妆下的殇ゞ 提交于 2019-12-04 01:17:05
I had a nasty typo that wasted my time and my colleague's time, it was something like this: for (i = 0; i < blah; i++); // <- I had a semi-colon here, that's the bug! { // Some awesome logic here } First of all, it's very embarrassing, second thing, I should never repeat this. I'm relatively new to C. In Java, I guess I can use FindBugs to catch errors like these, what tool should I use for C code? Lint? Yes, PC-Lint is probably the best tool available. Michael Burr In addition to Lykathea's PC-Lint suggestion , you can also get better (or at least more) diagnostics if you bump up the warning

“Cannot Resolve Symbol” Error when using android:id=“@+android:id/my_id”

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 23:28:36
When I am adding android:id/background to the namespace, Lint complains that it "Cannot Resolve Symbol" even though I am requesting to add it rather than call it. The code works as written, but the error persists. When I change <item android:id="@+android:id/background" to <item android:id="@+id/background" , the application stops working (another call breaks). My question is: why does Lint not recognize me adding android:id/background to the namespace even though a call to it functions well? Is there some better way to give this item an id that won't have Lint throw an error? All three of the

Lint for Objective-C? [duplicate]

余生长醉 提交于 2019-12-03 23:26:59
Possible Duplicate: Code linting for Objective C Is there any lint tool for Objective-c? Xcode includes the Clang static analyzer, labeled as Build and Analyze (simply Analyze under Xcode 4). http://clang-analyzer.llvm.org/xcode.html Edit: OCLint, based on Clang, provides additional checks of code style and complexity. http://oclint.org 来源: https://stackoverflow.com/questions/3926842/lint-for-objective-c

Check Android Permissions in a Method

落花浮王杯 提交于 2019-12-03 22:43:15
here is my code and it works perfectly fine . if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { mMap.setMyLocationEnabled(true); } But I don't like such a big code on every check, and want to delegate it to a method in my utility class. if (Utils.hasMapLocationPermissions(getActivity())) { mMap.setMyLocationEnabled(true); } But setMyLocationEnabled has annotation @RequiresPermission And