lint

How can I get scalac to tell me if I have unused variables?

蹲街弑〆低调 提交于 2020-01-01 04:21:08
问题 I just noticed a bug in my code where I created a new variable, but then failed to actually use it. I assumed that scalac would have told me that my new variable was unused, but this didn't seem to be the case, and after a small amount of googling / man page, I couldn't find anything about enabling warnings. What can I do to enable such warnings? 回答1: This stuff was just now discussed on the scala user mailing list. Result of the discussion: It's considererd task of IDE to do that (so far

How to recompile with -Xlint:deprecation

陌路散爱 提交于 2019-12-31 08:54:07
问题 I don't use Android Studio but I build everything from the command line using build.gradle . I generate a Lint report like this: ./gradlew lint This correctly generates a Lint report but it also says this: Note: MyActivity.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. This makes me wonder how I can do that? I've tried the following: ./gradlew lint -Xlint:deprecation But it doesn't work. It says: Problem configuring task :app:lint from command

Clean up unused Android permissions

孤人 提交于 2019-12-29 19:04:29
问题 If I wanted to research how and where permissions [requested in the Mainfest.xml] were used in an Android app for the purposes of removing them is there an easy way of doing this? Does lint or findbugs offer some sort of support for tracking permissions used/abused in a project? 回答1: I came from the future to save your lives. Here (in the future), LINT does check for missing permissions as you can see on LINT checks. So, go to your AndroidManifest.xml and remove all tags <uses-permission>

Could not find com.android.tools.lint:lint-gradle Android Studio 3

坚强是说给别人听的谎言 提交于 2019-12-29 03:12:07
问题 I have updated Android Studio to 3.0 and now received a lot of issues.. now stoped on point with such issue: Could not resolve all files for configuration ':applib:_lintClassPath'. > Could not find com.android.tools.lint:lint-gradle:26.1.0-alpha01. Searched in the following locations: file:/Users/anwender/Library/Android/sdk/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom file:/Users/anwender/Library/Android/sdk/extras/m2repository/com

Lint error “Do not treat position as fixed; only use immediately…”

蹲街弑〆低调 提交于 2019-12-28 04:18:10
问题 I'm contributing to open source library and got lint error "Do not treat position as fixed; only use immediately and call holder.getAdapterPosition() to look it up later" for this code: @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { mAdapter.onBindViewHolder(holder, position); if (!isFirstOnly || position > mLastPosition) { for (Animator anim : getAnimators(holder.itemView)) { anim.setDuration(mDuration).start(); anim.setInterpolator(mInterpolator); }

How to set ESLint rule to identify functions are either camelcase or not?

怎甘沉沦 提交于 2019-12-25 09:06:05
问题 If I check for ESLint docs there is a perfect plugin available for camel case properties, whereas the same thing I'm trying to identify functions if they are either camelcase or not. index.js var first_name; var lastName; function getFirstName(a,b){ return firstName; } .eslintrc module.exports = { "rules": { "camelcase": [2, {"properties": "always"}] } } if I ran eslint index.js , I will be getting a proper lint error like this 2:5 error Identifier 'first_name' is not in camel case camelcase

Real time rules with ktlint

白昼怎懂夜的黑 提交于 2019-12-25 01:13:28
问题 I am trying to use ktlint on my android project. Currently I am using these gradle plugins: org.jlleitschuh.gradle.ktlint org.jlleitschuh.gradle.ktlint-idea I can check the code using a manual gradle task, where the warnings will be displayed by the terminal. Is it possible to achive something like eslint in javascript? Example: 回答1: You will not get an error message like in eslint but using following method you won't need to deal with ktlint styling issues manually. Is not it much better

How do I suppress PC-Lint errors for C99-style initialization of structure members?

本小妞迷上赌 提交于 2019-12-24 17:46:41
问题 I am using PC-Lint 8.00x with the following options: +v -wlib(1) +fan +fas I receive a number of error messages from PC-Lint when I run code similar to the following: typedef union { struct { unsigned int a : 4; unsigned int b : 4; unsigned int c : 4; unsigned int d : 4; } bits; unsigned short value; } My_Value; int main (void) { My_Value test[] = { { .bits.a = 2, .bits.b = 3, //Errors 133 and 10 .bits.c = 2, .bits.d = 3, }, { .bits.a = 1, .bits.b = 1, //Errors 133 and 10 .bits.c = 1, .bits.d

pre-commit hook with lint

大兔子大兔子 提交于 2019-12-24 13:30:34
问题 I'm trying to add precommit-hook to my project, this is my script section on package.json: "scripts": { ... "lint": "npm run lint:sass && npm run lint:js", "lint:js": "ng lint", "lint:sass": "sass-lint src/**/*.scss -v -q" }... "pre-commit": [ "lint" ], If I only execute this line: npm run lint:sass && npm run lint:js Everything works great, but when I'm trying to add precommit my terminal just freeze on: git commit -m "Testing" running lint... 来源: https://stackoverflow.com/questions/47761550

Unexpected cast to AppCompatButton: layout tag was Button

江枫思渺然 提交于 2019-12-24 12:03:57
问题 From AppCompatButton reference page: This will automatically be used when you use Button in your layouts. You should only need to manually use this class when writing custom views. I'm casting a normal Button to AppCompatButton , so that I can use setSupportBackgroundTintList method: AppCompatButton button = (AppCompatButton) findViewById(R.id.normalButton); button.setSupportBackgroundTintList(ColorStateList.valueOf(tintColor)); It builds and runs without any problem, but Android Studio 1.4