{"action":"created","issue":{"url":"https://api.github.com/repos/nebula-plugins/gradle-lint-plugin/issues/38","repository_url":"https://api.github.com/repos/nebula-plugins/gradle-lint-plugin","labels_url":"https://api.github.com/repos/nebula-plugins/gradle-lint-plugin/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/nebula-plugins/gradle-lint-plugin/issues/38/comments","events_url":"https://api.github.com/repos/nebula-plugins/gradle-lint-plugin/issues/38/events","html_url":"https://github.com/nebula-plugins/gradle-lint-plugin/issues/38","id":162298085,"number":38,"title":"Error when running fixGradleLint","user":{"login":"manthanhd","id":1021727,"avatar_url":"https://avatars.githubusercontent.com/u/1021727?v=3","gravatar_id":"","url":"https://api.github.com/users/manthanhd","html_url":"https://github.com/manthanhd","followers_url":"https://api.github.com/users/manthanhd/followers","following_url":"https://api.github.com/users/manthanhd/following{/other_user}","gists_url":"https://api.github.com/users/manthanhd/gists{/gist_id}","starred_url":"https://api.github.com/users/manthanhd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manthanhd/subscriptions","organizations_url":"https://api.github.com/users/manthanhd/orgs","repos_url":"https://api.github.com/users/manthanhd/repos","events_url":"https://api.github.com/users/manthanhd/events{/privacy}","received_events_url":"https://api.github.com/users/manthanhd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-06-25T20:25:41Z","updated_at":"2016-09-23T15:19:08Z","closed_at":null,"body":"Hello,\r\n\r\nI'm trying to evaluate this plugin but cannot get the fixGradleLint task to work. I'm running gradle 2.12 on Windows 10.\r\n\r\nFirst of all I ran:\r\n```\r\nC:\\Users\\manthanhd\\Documents\\projects\\gradle-lint-test>gradle lintGradle\r\n:lintGradle                                                                                                                                                                       \r\n                           \r\nThis project contains lint violations.  A complete listing of the violations follows.\r\nBecause none were serious, the build's overall status was unaffected.\r\n\r\nwarning   unused-dependency                  one or more classes in org.springframework:spring-web:4.2.6.RELEASE are required by your code directly\r\n                           \r\nwarning   unused-dependency                  one or more classes in org.springframework.boot:spring-boot:1.3.5.RELEASE are required by your code directly\r\n                           \r\nwarning   unused-dependency                  one or more classes in org.springframework.boot:spring-boot-autoconfigure:1.3.5.RELEASE are required by your code directly\r\n                           \r\nwarning   unused-dependency                  one or more classes in org.springframework:spring-context:4.2.6.RELEASE are required by your code directly\r\n                           \r\n? build.gradle: 4 problems (0 errors, 4 warnings)\r\n\r\nTo apply fixes automatically, run fixGradleLint, review, and commit the changes.\r\n                           \r\n                           \r\nBUILD SUCCESSFUL\r\n               \r\nTotal time: 10.455 secs\r\n```\r\n\r\nAnd then to fix the issues, ran:\r\n```\r\nC:\\Users\\manthanhd\\Documents\\projects\\gradle-lint-test>gradle fixGradleLint\r\n:fixGradleLint FAILED                                                                                                                                                                \r\n               \r\nFAILURE: Build failed with an exception.\r\n               \r\n* What went wrong:\r\nExecution failed for task ':fixGradleLint'.\r\n> com.netflix.nebula.lint.jgit.api.errors.PatchApplyException: Cannot apply: HunkHeader[37,6->37,10]\r\n               \r\n* Try:         \r\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\r\n               \r\nBUILD FAILED   \r\n               \r\nTotal time: 10.414 secs\r\n```\r\n\r\nHere's the same command output but with --info. I truncated most output as it was too much.\r\n```\r\n...\r\nUsing version '1.7.21' for dependency 'org.slf4j:slf4j-api:1.7.20'                                                   \r\nUsing version '1.7.21' for dependency 'org.slf4j:slf4j-api:1.7.21'                                                   \r\nUsing version '9.2.16.v20160414' for dependency 'org.eclipse.jetty:jetty-server:9.2.16.v20160414'                    \r\nExcluding []                                                                                                         \r\nUsing version '4.5.2' for dependency 'org.apache.httpcomponents:httpclient:4.5.2'\r\nUsing version '1.3.5.RELEASE' for dependency 'org.springframework.boot:spring-boot-starter-web:'\r\nUsing version '1.3.5.RELEASE' for dependency 'org.springframework.boot:spring-boot-starter-jetty:'\r\n...\r\nUsing version '9.2.16.v20160414' for dependency 'org.eclipse.jetty:jetty-plus:9.2.16.v20160414'\r\nUsing version '1.1.7' for dependency 'ch.qos.logback:logback-core:1.1.7'\r\nUsing version '1.7.21' for dependency 'org.slf4j:slf4j-api:1.7.20'\r\nUsing version '1.7.21' for dependency 'org.slf4j:slf4j-api:1.7.21'\r\nUsing version '9.2.16.v20160414' for dependency 'org.eclipse.jetty:jetty-server:9.2.16.v20160414'\r\n:fixGradleLint FAILED                                             \r\n:fixGradleLint (Thread[main,5,main]) completed. Took 3.564 secs.\r\n               \r\nFAILURE: Build failed with an exception.\r\n               \r\n* What went wrong:\r\nExecution failed for task ':fixGradleLint'.\r\n> com.netflix.nebula.lint.jgit.api.errors.PatchApplyException: Cannot apply: HunkHeader[37,6->37,10]\r\n               \r\n* Try:         \r\nRun with --stacktrace option to get the stack trace. Run with --debug option to get more log output.\r\n               \r\nBUILD FAILED   \r\n               \r\nTotal time: 11.579 secs\r\n```\r\n\r\nHere's my `build.gradle` file for reference:\r\n```\r\nbuildscript {\r\n    repositories {\r\n        mavenCentral()\r\n        jcenter()\r\n    }\r\n    dependencies {\r\n        classpath(\"org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE\")\r\n    }\r\n}\r\n\r\nplugins {\r\n    id 'nebula.lint' version '0.30.12'\r\n}\r\n\r\nallprojects {\r\n    apply plugin: 'nebula.lint'\r\n    gradleLint.rules = ['unused-dependency'] // add as many rules here as you'd like\r\n}\r\n\r\napply plugin: 'java'\r\napply plugin: 'eclipse'\r\napply plugin: 'idea'\r\napply plugin: 'spring-boot'\r\n\r\njar {\r\n    baseName = 'gs-spring-boot'\r\n    version =  '0.1.0'\r\n}\r\n\r\nrepositories {\r\n    mavenCentral()\r\n    jcenter()\r\n}\r\n\r\nsourceCompatibility = 1.7\r\ntargetCompatibility = 1.7\r\n\r\ndependencies {\r\n    compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'\r\n    // tag::jetty[]\r\n    compile(\"org.springframework.boot:spring-boot-starter-web\") {\r\n        exclude module: \"spring-boot-starter-tomcat\"\r\n    }\r\n    compile(\"org.springframework.boot:spring-boot-starter-jetty\")\r\n    // end::jetty[]\r\n    // tag::actuator[]\r\n    compile(\"org.springframework.boot:spring-boot-starter-actuator\")\r\n    // end::actuator[]\r\n    testCompile(\"junit:junit\")\r\n}\r\n\r\ntask wrapper(type: Wrapper) {\r\n    gradleVersion = '2.1'\r\n}\r\n```\r\n\r\n^ file is mostly from [Spring Boot tutorial](https://spring.io/guides/gs/spring-boot/).\r\n\r\nI can see a `lint.patch` file in the `build` directory and when I apply it manually I can see a massive difference in the build size as its removing a lot of unused dependencies. \r\n\r\nHere's that lint.patch file:\r\n```\r\ndiff --git a/build.gradle b/build.gradle\r\n--- a/build.gradle\r\n+++ b/build.gradle\r\n@@ -36,6 +36,10 @@\r\n targetCompatibility = 1.7\r\n \r\n dependencies {\r\n+   compile 'org.springframework:spring-web:4.2.6.RELEASE'\r\n+   compile 'org.springframework.boot:spring-boot:1.3.5.RELEASE'\r\n+   compile 'org.springframework.boot:spring-boot-autoconfigure:1.3.5.RELEASE'\r\n+   compile 'org.springframework:spring-context:4.2.6.RELEASE'\r\n     compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'\r\n     // tag::jetty[]\r\n     compile(\"org.springframework.boot:spring-boot-starter-web\") {\r\n\r\n```\r\n\r\nAny ideas why the automated `fixGradleLint` task is not working?"},"comment":{"url":"https://api.github.com/repos/nebula-plugins/gradle-lint-plugin/issues/comments/249221225","html_url":"https://github.com/nebula-plugins/gradle-lint-plugin/issues/38#issuecomment-249221225","issue_url":"https://api.github.com/repos/nebula-plugins/gradle-lint-plugin/issues/38","id":249221225,"user":{"login":"Kinmarui","id":3742151,"avatar_url":"https://avatars.githubusercontent.com/u/3742151?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinmarui","html_url":"https://github.com/Kinmarui","followers_url":"https://api.github.com/users/Kinmarui/followers","following_url":"https://api.github.com/users/Kinmarui/following{/other_user}","gists_url":"https://api.github.com/users/Kinmarui/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinmarui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinmarui/subscriptions","organizations_url":"https://api.github.com/users/Kinmarui/orgs","repos_url":"https://api.github.com/users/Kinmarui/repos","events_url":"https://api.github.com/users/Kinmarui/events{/privacy}","received_events_url":"https://api.github.com/users/Kinmarui/received_events","type":"User","site_admin":false},"created_at":"2016-09-23T15:19:08Z","updated_at":"2016-09-23T15:19:08Z","body":"I had similar problem when trying to run fixGradleLint in cygwin on windows.\r\nRuning `dos2unix.exe */*.gradle` on whole project solved issue"}}
{"actor":{"display_login":"Kinmarui"}}