lint

Lint for Objective-C? [duplicate]

霸气de小男生 提交于 2019-12-21 07:05:05
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Code linting for Objective C Is there any lint tool for Objective-c? 回答1: 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-21 06:58:09
问题 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())

Running Android Lint has encountered a… Failed. java.lang.NullPointerException

余生长醉 提交于 2019-12-21 03:38:31
问题 I just added Google Play Service Library to my project and when I am making a modification in one of my project files I am keep getting an error dialog from eclipse: 'Running Android Lint' has encountered a problem. Failed. So, I enabled Error Log (Window -> Show View -> Error Log) tab and I found a warning and an error line: Error: Failed: com.android.ide.eclipse.adt java.lang.NullPointerException at com.android.tools.lint.checks.ApiDetector$ApiVisitor.checkField(ApiDetector.java:1416) at

How to suppress specific Lint warning for deprecated Android function?

最后都变了- 提交于 2019-12-20 17:47:08
问题 I use a version switch to support older Android versions. int sdk = Build.VERSION.SDK_INT; if (sdk < Build.VERSION_CODES.HONEYCOMB) { ColorDrawable colorDrawable = new ColorDrawable(shapeColor); //noinspection deprecation viewHolder.shape.setBackgroundDrawable(colorDrawable); } else { viewHolder.shape.setColor(shapeColor); } When build the project with Gradle from the command line the following warning is output by Lint: app/src/main/java/com/example/MyApp/CustomListAdapter.java:92: warning:

How can I check (My)SQL statements for syntactical correctness

狂风中的少年 提交于 2019-12-20 17:44:27
问题 we're currently setting up out integration server and during that process we've set up pre-commit hooks on the SVN so that our developers can't check in files that are syntactically invalid (primarily PHP and XML). We also have a bunch of .sql files (for MySQL) which I'd like to lint as well. Unfortunately, Google didn't turn up anything useful for this task. Any ideas? 回答1: The commercial version of MySQL Workbench has a syntax checker for MySQL statements, but of course that would only

Are there any lint tools for C and C++ that check formatting?

巧了我就是萌 提交于 2019-12-20 12:35:35
问题 I have a codebase that is touched by many people. While most people make an effort to keep the code nicely formatted (e.g. consistent indentation and use of braces), some don't, and even those that do can't always do it because we all use different editors, so settings like spaces vs. tabs are different. Is there any standard lint tool that checks that code is properly formatted, but doesn't actually change it (like indent but that returns only errors and warnings)? While this question could

How to configure package.json to run eslint script

。_饼干妹妹 提交于 2019-12-20 09:13:51
问题 So I am using eslint as a linter for my react project and I would like it to check all of my .js files. I am able to do this through the script: "lint": "eslint back/*.js && eslint backTest/*.js && eslint front/actions/*.js" how can I get it to examine every .js file recursively, something like: "lint": "eslint -r *.js" This would save me having to type out each file inidvidually Thanks in advance for the help 回答1: eslint "**/*.js" to run on all js files in all the folders recursively (in the

Webpack config has an unknown property 'preLoaders'

怎甘沉沦 提交于 2019-12-18 11:42:26
问题 I'm learning webpack from scratch. I've learned how to link javascript files with require. I'm bundling and minifying my js files and i'm listening for changes with watch. I'm setting up loaders to convert my sass files to css. But when I try to setup a linting process with jshint-loader, i'm running into issues. module: { preLoaders: [ { test: /\.js$/, // include .js files exclude: /node_modules/, // exclude any and all files in the node_modules folder loader: "jshint-loader" } ], loaders: [

Resolved color instead of a resource id

一个人想着一个人 提交于 2019-12-17 23:15:02
问题 Recently I've seen appeared a lint error in my code: Should pass resolved color instead of resource id here: getResources().getColor(R.color.maps_list_background_color) MyClass.java /myapp/android/maps line 107 Android Lint Problem I know how to resolve it the answer is in the error, the thing is I don't get why they have added this error in the linter. 回答1: Methods that take a color in the form of an integer should be passed an RGB triple, not the actual color resource id. You must call

how do i get a java maven build to fail for compiler warnings?

烂漫一生 提交于 2019-12-17 19:33:16
问题 I am trying: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> <compilerArgument>-Werror</compilerArgument> <fork>true</fork> </configuration> </plugin> but with no joy. Any ideas now to get medieval on such errors as suggested at this blog post? 回答1: EDIT: This answer is outdated however I can't delete it as it was an accepted answer at the time. This a bug