2012-11-22 17 views
9

हमारी एंड्रॉइड प्रोजेक्ट कुछ बाहरी परियोजनाओं पर निर्भर है जिस पर हमारे पास नियंत्रण नहीं है। इसलिए मैं कस्टम lint.xml फ़ाइल सेट अप करने का प्रयास कर रहा हूं ताकि हम उनके लिए अनदेखा नियम जोड़ सकें। शुरू करने परिदृश्य के रूप में मैं चेतावनीलेखन कस्टम lint.xml

lint app --disable FloatMath,DefaultLocale,ViewConstructor --xml lint-result.xml 

में निम्न आदेश के साथ ActionBarSherlock से दूर करने के लिए (कोई अपराध जेक)

<?xml version="1.0" encoding="UTF-8"?> 
<lint> 
    <issue id="FloatMath"> 
    <ignore path="app/target/classes/com/actionbarsherlock/*" /> 
    </issue> 
    <issue id="DefaultLocale"> 
    <ignore path="app/target/classes/com/actionbarsherlock/*" /> 
    </issue> 
    <issue id="ViewConstructor"> 
    <ignore path="app/target/classes/com/actionbarsherlock/*" /> 
    </issue> 
</lint> 

की कोशिश की लेकिन रिपोर्ट का उत्पादन अभी भी एबीएस से संदेश भी शामिल थे।

अद्यतन मैं

के आदेश बदल
lint --disable FloatMath,DefaultLocale,ViewConstructor --xml lint-result.xml app 

जेनकींस के लिए कोई बदलाव नहीं करता है अभी भी कोई बात नहीं क्या में है एक ही रिपोर्ट का उत्पादन पर ध्यान न दें, लेकिन यदि कमांड लाइन यह करता है में चला सूचीबद्ध सभी मुद्दों पर ध्यान नहीं देता अक्षम करने के बाद। मेरी इच्छा है कि कहने का एक आसान तरीका है, हे मैवेन के तरीके से चीजों को अनदेखा/बहिष्कृत करें ...

+0

मैं अपने प्रोजेक्ट की जड़ में अपने जवाब के 'lint.xml' रखा। हालांकि कोई बदलाव नहीं है। क्या आप लिंट चलाने के लिए 'mvn android: lint' का उपयोग कर रहे हैं या आपने निर्माण प्रक्रिया के भीतर लिंट निष्पादित करने के लिए' maven-compiler-plugin 'को कॉन्फ़िगर किया है [यहां वर्णित] [http://blog.octo.com/en/add- फाहा-चेकों-टू-android-Maven-बनाता है /)? कृपया अपनी कॉन्फ़िगरेशन जोड़ें। – JJD

+0

मैं जेनकिंस पर खोल से लिंट का आविष्कार कर रहा हूं 'lint --config lint.xml --xml lint-result.xml।' या 'lint --config lint.xml' अगर आप इसे स्थानीय रूप से चलाते हैं। इस तरह आप सीधे एंड्रॉइड लिंट उपकरण चलाते हैं। मैंने एंड्रॉइड मेवेन प्लगइन के साथ इसे आजमाया नहीं है, लेकिन मुझे उम्मीद है कि बहिष्करण लिंट फ़ाइल –

उत्तर

8

एक बार फिर से अपने प्रश्न का उत्तर दें ... lint.xml अब इस तरह दिखता है और यह किसी को अनदेखा कर देगा ActionBarSherlock ASB 4.2.0 पर रिपोर्ट

<?xml version="1.0" encoding="UTF-8"?> 
<lint> 
    <issue id="NewApi"> 
    <ignore path="target/classes/com/actionbarsherlock/internal/ActionBarSherlockNative.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/ActionBarSherlockNative$ActionModeWrapper.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/app/ActionBarWrapper.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$TabWrapper.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/view/ActionProviderWrapper.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItemView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter$HasPermanentMenuKey.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsAdapterView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsProgressBar.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/ActionBarView$HomeView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/widget/SearchView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/nineoldandroids/widget/NineHorizontalScrollView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/nineoldandroids/view/NineViewGroup.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/view/menu/BaseMenuPresenter.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/AbsActionBarView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/ActionBarContextView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/ActionBarView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/CapitalizingButton.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/CapitalizingTextView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsAbsSpinner.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsLinearLayout.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsListPopupWindow.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/ScrollingTabContainerView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/widget/ActivityChooserView$SetActivated.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/app/SherlockActivity.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/app/SherlockExpandableListActivity.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/app/SherlockListActivity.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/app/SherlockPreferenceActivity.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/ActionBarSherlockNative$ActionModeCallbackWrapper.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/app/ActionBarImpl$1.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/app/ActionBarImpl.class" /> 
    </issue> 

    <issue id="FloatMath"> 
    <ignore path="target/classes/com/actionbarsherlock/internal/nineoldandroids/view/animation/AnimatorProxy.class" /> 
    </issue> 

    <issue id="DefaultLocale"> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/CapitalizingTextView.class" /> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/CapitalizingButton.class" /> 
    </issue> 

    <issue id="ViewConstructor"> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/CollapsibleActionViewWrapper.class" /> 
    </issue> 

    <issue id="WrongCall"> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsAdapterView.class" /> 
    </issue> 
</lint> 

शैल निष्पादन आदेश है कि अब हम का उपयोग करें

lint --config lint.xml --xml lint-results.xml .; 

पुनश्च: कृपया ध्यान रखें कि इस तरह इस मामले में के रूप में एबीएस बाहर रखा गया APKLIB की सभी रिपोर्टों को दूर नहीं होगा अब तक रिपोर्ट को बाहर करने का कोई तरीका नहीं है आर क्लास के अप्रयुक्त संसाधन। संकलित प्रक्रिया पर लिंक लाइब्रेरी के आर। क्लास और आपकी प्रोजेक्ट विलय हो जाती है और लिंट को यह जानने का कोई तरीका नहीं है। यह केवल कुछ संदर्भों के साथ एकल आर क्लास को देखता है जिसका उपयोग नहीं किया जाता है और उन्हें रिपोर्ट करता है।

+0

ग्रेट, लेकिन अपूर्ण जोड़ने के लिए कॉन्फ़िगरेशन में एक जगह होनी चाहिए। लिंट में कक्षाओं को बाहर करने के लिए एक तंत्र होना चाहिए ... – Snicolas

+0

स्निकोलस मैं सहमत हूं, Google को इसे और अधिक पॉलिश करने की आवश्यकता है क्योंकि प्रोजेक्ट "एड-ऑन" पुस्तकालयों के लिए सभी कक्षाओं को सूचीबद्ध करना सिर्फ पागल घर है। दूसरी बात यह है कि अप्रयुक्त संसाधन की आर.क्लास रिपोर्ट की समस्या को हल नहीं करता है जिसे लाइब्रेरी –

1

मैंने अधिक actionbarsherlock त्रुटियों को बाहर करने के लिए lint.xml फ़ाइल को पूरा कर लिया है। हालांकि, पैकेज पैकेज को बाहर करना अच्छा लगेगा।

<?xml version="1.0" encoding="UTF-8"?> 
<lint> 
    <issue id="NewApi"> 
    <ignore path="target/classes/com/actionbarsherlock/internal/ActionBarSherlockNative.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/ActionBarSherlockNative$ActionModeWrapper.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/app/ActionBarWrapper.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$TabWrapper.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/view/ActionProviderWrapper.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItemView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter$HasPermanentMenuKey.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsAdapterView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsProgressBar.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/ActionBarView$HomeView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/widget/SearchView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/AbsActionBarView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/ActionBarContextView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/app/ActionBarImpl$1.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/app/ActionBarImpl.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/ActionBarSherlockNative$ActionModeCallbackWrapper.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/ActionBarView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/widget/ActivityChooserView$SetActivated.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/view/menu/BaseMenuPresenter.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/CapitalizingButton.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/CapitalizingTextView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsAbsSpinner.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsLinearLayout.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/IcsListPopupWindow.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/nineoldandroids/widget/NineHorizontalScrollView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/nineoldandroids/view/NineViewGroup.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/ScrollingTabContainerView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/app/SherlockActivity.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/app/SherlockExpandableListActivity.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/app/SherlockListActivity.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/app/SherlockPreferenceActivity.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout.class"/> 
    <ignore path="target/classes/com/viewpagerindicator/IcsLinearLayout.class"/> 
</issue> 

<issue id="FloatMath"> 
    <ignore path="target/classes/com/actionbarsherlock/internal/nineoldandroids/view/animation/AnimatorProxy.class"/> 
</issue> 

<issue id="DefaultLocale"> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/CapitalizingTextView.class"/> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/CapitalizingButton.class"/> 
</issue> 

<issue id="ViewConstructor"> 
    <ignore path="target/classes/com/actionbarsherlock/internal/widget/CollapsibleActionViewWrapper.class"/> 
</issue> 
</lint> 
+0

द्वारा लाया गया था जैसा कि मैंने कहा था, यह केवल कक्षाओं का ख्याल रखता है। यदि आप लिंट परिणाम रिपोर्ट की जांच करते हैं तो आपको आर क्लास से जुड़े अप्रयुक्त संसाधनों के बहुत सारे मिलेंगे –

9

अब ऐसा करना संभव है:

<?xml version="1.0" encoding="UTF-8"?> 
<lint> 
    <issue id="all"> 
     <ignore regexp="target/classes/com/actionbarsherlock/.*[.]class" /> 
    </issue> 
</lint> 
संबंधित मुद्दे