lint

TSLint Error “Expected a 'for-of' loop instead of a 'for' loop with this simple iteration”

人盡茶涼 提交于 2019-12-24 11:16:52
问题 I have a for loop to get an ID from the DB: for(var i = 0; i < data.GetContractId.length; i++) { if (data.GetContractId[i].ContractId) { this.contractExists = true; } } Now I get the following TSLint-Error: Expected a 'for-of' loop instead of a 'for' loop with this simple iteration I'm not sure how to use it in this instance, can anyone help? 回答1: TSLint see that you could use for-of instead of for-loop it's just enhanced and more cleaner for (let contract of data.GetContractId) { if

Android Studio and Lint don't generate an error when an IntDef field is assigned a wrong value

南楼画角 提交于 2019-12-24 04:05:09
问题 Here is my code: Const.kt package sample.com.sample_app object Const { const val NAVIGATION_MODE_STANDARD = 1 const val NAVIGATION_MODE_LIST = 2 } NavigationMode.kt package sample.com.sample_app import android.support.annotation.IntDef import java.lang.annotation.Retention import java.lang.annotation.RetentionPolicy.SOURCE @Retention(SOURCE) @IntDef(Const.NAVIGATION_MODE_LIST, Const.NAVIGATION_MODE_STANDARD) annotation class NavigationMode OtherAct.kt package sample.com.sample_app import

Eslint arrow-body-style error in react.js

对着背影说爱祢 提交于 2019-12-24 00:26:53
问题 Using Airbnb's eslint rules, I'm getting the following error in my react code but I'm not sure what's the error. const Facebook = ({ appId, url }) => { return ( <div className={styles.facebook}> <FacebookProvider appID={appId}> <EmbeddedPost href={url} width="auto" /> </FacebookProvider> </div> ) } Getting an error at the beginning of line 1 { bracket. Unexpected block statement surrounding arrow body. (arrow-body-style) Tried wrapping the curly brackets with parenthesis brackets but in turn,

How can I tell lint to track a custodial pointer to a vector?

扶醉桌前 提交于 2019-12-24 00:18:47
问题 I have some code that loops and news up some pointers and stores them in a vector: std::vector<InputBox*> m_octets; ... InputBox* octet = new InputBox(rect, title, touch_num); m_octets.push_back(octet); In the class destructor I for_each over m_octets and invoke the destructor for each pointer. I think this is all good. It all compiles and the unit tests pass. The problem is Gimpel's PC-lint doesn't like it. It sees that `octet' is a custodial pointer that has not been freed (Warning 429). I

C99 Designated Initializer duplicate index not flagged at all in build output or lint

倖福魔咒の 提交于 2019-12-23 18:23:24
问题 I played around with designated initializers a bit the other day and noticed, to my surprise, that it is valid to use the same index more than once. What's more, it didn't even produce a compiler warning, error, or even informational statement when I did so, and even PC-Lint didn't seem to care (which I think surprised me the most). I'm wondering if there's a reason for compilers not even providing an information message in this case or if there are additional compiler/lint/etc. options that

Android Studio lint.xml configuration

孤街醉人 提交于 2019-12-23 07:50:04
问题 I would like to configure lint in Android Studio to ignore some file. I have placed the lint.xml file in app/ folder. Here is the content of the lint file: <?xml version="1.0" encoding="UTF-8"?> <lint> <issue id="UnusedResources"> <ignore path="res/drawable/background_palette_drawable_6.xml" /> </issue> </lint> When I run lint to check for unused resources it still finds this file as unused. In app build.gradle I have: lintOptions { disable 'InvalidPackage' abortOnError false absolutePaths

Why gradle lint think ellipsis character “…” is more readable than “…”?

江枫思渺然 提交于 2019-12-23 02:17:50
问题 I define a string "XXX..." in string.xml and get a gradle lint issue. Replace "..." with ellipsis character (…, …) ? Explanation: Ellipsis string can be replaced with ellipsis character. You can replace the string "..." with a dedicated ellipsis character, ellipsis character (…, …). This can help make the text more readable. Why is "…" more readable than "..."? When someone see "&#8230", I don't think he/she can realize that this is a ellipsis character. 回答1: It's about good typography. The

Exclude files from Android Studio lint spell checker

五迷三道 提交于 2019-12-22 02:07:03
问题 The Android Studio lint spell checker flags hex codes that look to it like words in certain files that would be better off unchecked, such as values/colors.xml and build/intermediates/dex-cache/cache.xml . How do I tell lint to not spell check certain folders or files? 回答1: This can be done by using IDE scopes. In Android Studio (at least 3.4) you can configure each inspection per scope. The idea is that you create a scope that contains all files you don't want to be spellchecked, and then

Exclude files from Android Studio lint spell checker

喜夏-厌秋 提交于 2019-12-22 02:06:14
问题 The Android Studio lint spell checker flags hex codes that look to it like words in certain files that would be better off unchecked, such as values/colors.xml and build/intermediates/dex-cache/cache.xml . How do I tell lint to not spell check certain folders or files? 回答1: This can be done by using IDE scopes. In Android Studio (at least 3.4) you can configure each inspection per scope. The idea is that you create a scope that contains all files you don't want to be spellchecked, and then

Android lint enable checks with gradle

跟風遠走 提交于 2019-12-22 00:13:38
问题 I want to execute some of the 11 disabled checks. The Android Lint documentation just said about this Some checks are disabled by default. These can be enabled by adding the --enable flag. How can I activate them for my gradle build? I can't find any options to do that within the build.gradle or lint.xml file. 回答1: From Lint Support As of version 0.7.0, you can run lint for a specific variant, or for all variants, in which case it produces a report which describes which specific variants a