Giter VIP home page Giter VIP logo

editorconfig-maven-plugin's Introduction

editorconfig-maven-plugin

License Maven Central Travis CI build status AppVeyor Windows CI build status

editorconfig-maven-plugin is a Maven plugin for checking whether project files comply with format rules defined in .editorconfig files and eventually also for fixing the violations.

โš ๏ธ
editorconfig-maven-plugin is new. Expect issues of all kinds which is not to say that you should not report them :)

Basic usage

editorconfig-maven-plugin requires Java 8+ and Maven 3.3.1+.

To make the build fail if any of your source files does not comply with .editorconfig rules, add the following to your project:

  <plugin>
    <groupId>org.ec4j.maven</groupId>
    <artifactId>editorconfig-maven-plugin</artifactId>
    <version><!-- check the latest on http://search.maven.org/maven2/org/ec4j/maven/editorconfig-maven-plugin/ --></version>
    <executions>
      <execution>
        <id>check</id>
        <phase>verify</phase>
        <goals>
          <goal>check</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <!-- See http://ec4j.github.io/editorconfig-maven-plugin/ for full configuration reference -->
      <excludes>
        <!-- Note that maven submodule directories and many non-source file patterns are excluded by default -->
        <!-- see https://github.com/ec4j/editorconfig-linters/blob/master/editorconfig-lint-api/src/main/java/org/ec4j/lint/api/Constants.java#L37 -->
        <!-- You can exclude further files from processing: -->
        <exclude>src/main/**/*.whatever</exclude>
      </excludes>
      <!-- All files are included by default:
      <includes>
        <include>**</include>
      </includes>
      -->
    </configuration>
  </plugin>

In case any violations are detected, you may want to fix them automagically by running

mvn editorconfig:format

Configuration

How it works

editorconfig-maven-plugin is designed around the Linter interface. Linter is a processor specialized for some particular file format (such as YAML or XML) for which it can detect whether some particular .editorconfig properties are satisfied and eventually propose a fix that can be applied automatically.

Table 1. Linters available in editorconfig-maven-plugin
Class name Default includes Default excludes Supported .editorconfig properties

TextLinter

**/*

end_of_line, trim_trailing_whitespace, insert_final_newline

XmlLinter

**/*.xml, **/*.xsl

indent_style, indent_size

Contributions of further Linters are highly welcome! Please open an issue when you start working on something to avoid duplicate work.

How to build

Prerequisites:

  • Java 8+

  • Optionally Maven 3.5.0+, unless you want to use ./mvnw or mvnw.bat delivered by the project

The most common build with unit tests:

./mvnw clean install

On Windows:

.\mvnw.cmd clean install

Misc.

editorconfig-maven-plugin's People

Contributors

baumicoder avatar bennetelli avatar dependabot[bot] avatar dwalluck avatar olevett avatar ppalaga avatar vrevelas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

editorconfig-maven-plugin's Issues

.editorconfig file not found windows 10

[WARNING] Using current platform's default encoding UTF-8 to read .editorconfig files. You do not want this. Set either 'project.build.sourceEncoding' or 'editorconfig.encoding' property.
[ERROR] No .editorconfig properties applicable for files under 'C:\Projects\web\assembly\minuteProject'

i have .editorconfig file next pom.xml but the maven plugoin didn't found the editorconfig file :-(

Text file considered as binary

The attached text file is considered as binary, resulting in build failure. If you remove the accented characters the problem will disappear.

simplelogger.properties.zip

Command
mvn org.ec4j.maven:editorconfig-maven-plugin:check -Deditorconfig.excludes="db/**,log/**"

Maven output

[ERROR] Failed to execute goal org.ec4j.maven:editorconfig-maven-plugin:0.0.5:check (default-cli) on project xyz: 
[ERROR] 
[ERROR] Could not read /home/user/ambiente/workspace/xyz/src/main/resources/simplelogger.properties. This may mean that it is a binary file and you should exclude it from editorconfig processing.
[ERROR] 
[ERROR] : Input length = 1
[ERROR] -> [Help 1]

Maven output with relevant stacktrace

Caused by: java.nio.charset.MalformedInputException: Input length = 1
	at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
	at java.io.InputStreamReader.read(InputStreamReader.java:184)
	at java.io.BufferedReader.fill(BufferedReader.java:161)
	at java.io.BufferedReader.read(BufferedReader.java:182)
	at org.ec4j.maven.lint.api.LineReader$DelegatingLineReader.read(LineReader.java:66)
	at org.ec4j.maven.lint.api.LineReader$DelegatingLineReader.readLine(LineReader.java:124)
	at org.ec4j.maven.linters.TextLinter.process(TextLinter.java:156)
	... 23 more

[Query] Editor Config Maven Plugin for Java

Hi,

I have a question about the editor config maven plugin. I see the formatting works for .xml files, not for java. Please let me know if the plugin supports formatting the Java files.

insert_final_newline does not work

editorconfig:check and editorconfig:format do not recognize missing newline if insert_final_newline = true.

I made a little sample project here. Only insert_final_newline and trim_trailing_whitespace are set to true.

The editorconfig:check only find the trailing whitespaces. The missing newlines in the two java files are not recognized:

[INFO] --- editorconfig:0.1.3:check (default-cli) @ MavenEditorConfigTest ---
[ERROR] src/main/java/org/example/Main.java@3,20: Delete 4 characters - violates trim_trailing_whitespace = true, reported by org.ec4j.linters.TextLinter
[ERROR] src/main/java/org/example/Main.java@5,1: Delete 8 characters - violates trim_trailing_whitespace = true, reported by org.ec4j.linters.TextLinter
[INFO] Checked 7 files

editorconfig:format also only correct the whitespaces errors.

Is there some miss configuration on my site or is it a bug?

Disable the check for single mvn calls

Hi,

I wanted to ask if there is any possibility to prevent the check while running mvn install. Our pipeline needs to do this call, but in between the pipeline created files, which will be checked by the editorconfig:check call.
This check fails because the generated files doesn't follow a specified rules. It would be hard to exclude these files, because they will be generated in folders which already have checked files and the file names are not predictable.

I'm looking for a parameter like -DSkipTests. Just for the editorconfig plugin. Something like mvn clean install -DskipChecks .

T

standalone XML files

The plugin complains about the embedded DTD end tag:
line XX:XX extraneous input '\n]>\n\n' expecting {COMMENT, SEA_WS, '<', PI}

example of the XML file:

<?xml version="1.0" standalone="yes" ?>

<!--open the DOCTYPE declaration -
  the open square bracket indicates an internal DTD-->
<!DOCTYPE foo [

<!--define the internal DTD-->
  <!ELEMENT foo (#PCDATA)>

<!--close the DOCTYPE declaration-->
]>

<foo>Hello World.</foo>

Question: How can I run the formatter on Maven sub projects?

Hello,

I am experimenting with this plugin. It is nicely detecting rule violations in the root of a project (e.g. in POM.xml) but it is not detecting violations in Java files.

The exemple project is this one:
https://github.com/Oliver-Loeffler/scenebuilder/tree/issue-485-demo

What would be the right way to configure the plugin and to run the plug in order to detect and correct format violations in Java sources as well? I was playing with many different settings the last days but nothing worked like expected - however, my expectation can be wrong as well.

I was using:

mvn editorconfig:check
mvn editorconfig:format

with the following config:

# EditorConfig is awesome: https://EditorConfig.org
root = true

[*.java]
indent_style = space
indent_size = 4

[*.fxml]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2

[pom.xml]
indent_style = space
indent_size = 4

The source file app\src\main\java\com\oracle\javafx\scenebuilder\app\AppPlatform.java is full of tabs and I'd expect a complaint/violation for this file. It works well with the main (reactor) POM.xml but not with any of the sources.

The plugin is configured like:

    <build>
        <pluginManagement>
            <plugin>
                    <groupId>org.ec4j.maven</groupId>
                    <artifactId>editorconfig-maven-plugin</artifactId>
                    <version>0.1.3</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
               <plugin>
                    <groupId>org.ec4j.maven</groupId>
                    <artifactId>editorconfig-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>check</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
        <plugins>
    </build>

Thanks in advance!
Oliver

Plugin not apply indent_style, indent_size to *.java files

I need to format the *.java code with indent_style, indent_size configured in the .editorconfig but I don't see any changes when executing the phase mvn editorconfig:format.

My plugin in the pom.xml is this

			<plugin>
				<groupId>org.ec4j.maven</groupId>
				<artifactId>editorconfig-maven-plugin</artifactId>
				<version>0.0.10</version>
				<executions>
					<execution>
						<id>check</id>
						<phase>verify</phase>
						<goals>
							<goal>check</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<includes>
						<include>**/*.java</include>
					</includes>
				</configuration>
			</plugin>

DirectoryScanner missing on Maven 3.9.0

Hi,

after my maven upgrade some problems occured.

mvn --version

pache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /usr/local/Cellar/maven/3.9.0/libexec
Java version: 17.0.5, vendor: Amazon.com Inc., runtime: /Users/myuser/.sdkman/candidates/java/17.0.5-amzn
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "13.2.1", arch: "x86_64", family: "mac"
user@My-MBP demo % mvn clean test
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ demo ---
[INFO] Deleting /Users/user/Downloads/demo/target
[INFO]
[INFO] --- editorconfig:0.1.1:check (check) @ demo ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.608 s
[INFO] Finished at: 2023-02-23T17:14:07+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.ec4j.maven:editorconfig-maven-plugin:0.1.1:check (check) on project demo: Execution check of goal org.ec4j.maven:editorconfig-maven-plugin:0.1.1:check failed: A required class was missing while executing org.ec4j.maven:editorconfig-maven-plugin:0.1.1:check: org/codehaus/plexus/util/DirectoryScanner
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.ec4j.maven:editorconfig-maven-plugin:0.1.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/user/.m2/repository/org/ec4j/maven/editorconfig-maven-plugin/0.1.1/editorconfig-maven-plugin-0.1.1.jar
[ERROR] urls[1] = file:/Users/user/.m2/repository/org/ec4j/linters/editorconfig-lint-api/0.2.1/editorconfig-lint-api-0.2.1.jar
[ERROR] urls[2] = file:/Users/user/.m2/repository/org/ec4j/core/ec4j-core/0.2.1/ec4j-core-0.2.1.jar
[ERROR] urls[3] = file:/Users/user/.m2/repository/org/ec4j/linters/editorconfig-linters/0.2.1/editorconfig-linters-0.2.1.jar
[ERROR] urls[4] = file:/Users/user/.m2/repository/org/antlr/antlr4-runtime/4.7/antlr4-runtime-4.7.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : org.codehaus.plexus.util.DirectoryScanner
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

I created a new spring boot application on start.spring.io .
Then I changed pom.xml to use the editorconfig-maven-plugin:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.0.3-SNAPSHOT</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.example</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>demo</name>
	<description>Demo project for Spring Boot</description>
	<properties>
		<java.version>17</java.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
        <plugins>
            <plugin>
                <groupId>org.ec4j.maven</groupId>
                <artifactId>editorconfig-maven-plugin</artifactId>
                <version>0.1.1</version>
                <executions>
                    <execution>
                        <id>check</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <inherited>true</inherited>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
	<repositories>
		<repository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<releases>
				<enabled>false</enabled>
			</releases>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</pluginRepository>
		<pluginRepository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<releases>
				<enabled>false</enabled>
			</releases>
		</pluginRepository>
	</pluginRepositories>

</project>

Using the "mvnw" (version 3.8.6) works fine. So it seems to be related with maven 3.9.0

Maybe somebody can help.

T

Mark mojos as threadSafe

Both Mojos use the default setting of threadSafe = false, resulting in warnings when the plugin is used in parallel Maven builds.

According to SO: Maven Thread Safe Plugin Pitfalls a Mojo should basically be thread-safe if its instantiation strategy is per-lookup and it doesn't use static variables.

This is true for both Mojos. So would it be sufficient to just set threadSafe = true in both Mojos to get rid of the warnings?

Ignore files in .gitignore

It would be nice if the plugin ignored files that match patterns in .gitignore by default. I currently have to add new directories (e.g. node_modules) to both .gitignore and to the plugin's in my pom.xml.

No support for java files

I initially was impressed with this plugin and thought of adding it in our CI/CD pipelines. Eventually I figured out the support was available only for .xml files like pom.xml. It doesn't work on *.java files.

IllegalArgumentException: Null charset name when project.build.sourceEncoding is not set

gin:0.0.2:check failed: Null charset name
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution check of goal org.ec4j.maven:editorconfig-maven-plugin:0.0.2:check failed: Null charset name
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.IllegalArgumentException: Null charset name
    at java.nio.charset.Charset.lookup (Charset.java:457)
    at java.nio.charset.Charset.forName (Charset.java:528)
    at org.ec4j.maven.AbstractEditorconfigMojo.execute (AbstractEditorconfigMojo.java:186)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

We should defer to Charset.defaultCharset() if project.build.sourceEncoding is not set.

Wrong tab indentation with XML linter

When using the XML linter and tab indentation one gets wrong indentation handling.

Editorconfig:

[*.{xml}]
indent_style = tab
indent_size = tab
tab_width = 4

The result is, that the Editorconfig Maven Plugin demands for each indentation level 4 tabs, for example for 2 indentations then 8 tabs. This is also the case when setting indent_size=4 and omitting tab_width.

What works, but this is not conforming to Editorconfig:

[*.{xml}]
indent_style = tab
indent_size = 1
tab_width = 4

Then the plugin uses 1 tab for indentation. But IDEs like Intellij then set indent size to 1 character and ignore the tab width.

The spec on editorconfig.org states:

  • indent_style: set to tab or space to use hard tabs or soft tabs respectively.
  • indent_size: a whole number defining the number of columns used for each indentation level and the width of soft tabs (when supported). When set to tab, the value of tab_width (if specified) will be used.
  • tab_width: a whole number defining the number of columns used to represent a tab character. This defaults to the value of indent_size and doesn't usually need to be specified

Invalid editorconfig.excludes throw NullPointerException

If run

mvn org.ec4j.maven:editorconfig-maven-plugin:check -Deditorconfig.excludes="db/**,log/**,hibernate.properties,"

whith a , at the end, throw an NullPointerException in org.ec4j.maven.AbstractEditorconfigMojo.scanIncludedFiles(AbstractEditorconfigMojo.java:316)

Maybe validating the input and throwing a more user friendly message is better.

Failure to run with Maven due to slf4j stuff

Tried running on a project using mvn editorconfig:check.

Unfortunately, it is failing with

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.190 s
[INFO] Finished at: 2018-12-07T09:51:06+00:00
[INFO] Final Memory: 13M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.ec4j.maven:editorconfig-maven-plugin:0.0.7:check (default-cli) on project xxxxxx: Execution default-cli of goal org.ec4j.maven:editorconfig-maven-plugin:0.0.7:check failed: Could not find org.ec4j.maven.lint.api.Logger$LogLevel for org.slf4j.Logger [org.slf4j.impl.SimpleLogger(org.ec4j.maven.lint.api.LinterRegistry)] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.ec4j.maven:editorconfig-maven-plugin:0.0.7:check (default-cli) on project xxxxxx: Execution default-cli of goal org.ec4j.maven:editorconfig-maven-plugin:0.0.7:check failed: Could not find org.ec4j.maven.lint.api.Logger$LogLevel for org.slf4j.Logger [org.slf4j.impl.SimpleLogger(org.ec4j.maven.lint.api.LinterRegistry)]
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.ec4j.maven:editorconfig-maven-plugin:0.0.7:check failed: Could not find org.ec4j.maven.lint.api.Logger$LogLevel for org.slf4j.Logger [org.slf4j.impl.SimpleLogger(org.ec4j.maven.lint.api.LinterRegistry)]
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.lang.IllegalStateException: Could not find org.ec4j.maven.lint.api.Logger$LogLevel for org.slf4j.Logger [org.slf4j.impl.SimpleLogger(org.ec4j.maven.lint.api.LinterRegistry)]
        at org.ec4j.maven.Slf4jLintLogger.toEc4jLogLevel(Slf4jLintLogger.java:39)
        at org.ec4j.maven.Slf4jLintLogger.<init>(Slf4jLintLogger.java:47)
        at org.ec4j.maven.AbstractEditorconfigMojo.buildLinterRegistry(AbstractEditorconfigMojo.java:165)
        at org.ec4j.maven.AbstractEditorconfigMojo.execute(AbstractEditorconfigMojo.java:219)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 21 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Sometimes check goal fails during a Jenkins build

Hi, our CI pipeline run o Jenkins occasionally fails with:
Failed to execute goal org.ec4j.maven:editorconfig-maven-plugin:0.1.0:check (check) on project parent: /srv/jenkins/<some-path>/jenkins-log.txt

I believe that the fileset being verified, as well as plugin configuration is correct as the above error happens only sporadically. A re-run of the build job always succeeds.
Is there any way to make editorconfig plugin more verbose to help identify the problem?
Currently nothing apart from that message appears in the build log. I am also not able to access the jenkins-log.txt file mentioned in the message as is is probably just deleted after the Jenkins job finishes.

I am using editorconfig plugin in version 0.1.0

Thanks.

YAML Linter

Are we planning to add a YAML linter ? If not can you point me docs how to contribute a new linter?

A pair has a key but not a value

I have exported the current style from IJ IDEA, it makes a pair without value

...
ij_smart_tabs = false
ij_visual_guides = 
ij_wrap_on_typing = false
...

The check fails with the message Execution default-cli of goal org.ec4j.maven:editorconfig-maven-plugin:0.1.3:check failed: Property 'ij_visual_guides' has no value at 15:20

Support utf-8-bom encoding

Try with following .editorconfig


root = true

[*.{cs,shader}]
charset = utf-8-bom
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

Leads following error.

11:24:16.809 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
11:24:16.809 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
11:24:16.809 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
11:24:16.810 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
11:24:16.810 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':editorconfigFormat'.
11:24:16.810 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > There was a failure while executing work items
11:24:16.810 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]    > A failure occurred while executing org.ec4j.gradle.runtime.EditorconfigInvoker
11:24:16.810 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]       > utf-8-bom
11:24:16.810 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
11:24:16.810 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
11:24:16.810 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]  Run with --scan to get full insights.
11:24:16.810 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
11:24:16.810 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':editorconfigFormat'.
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:96)
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:65)
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ActionEventFiringTaskExecuter.execute(ActionEventFiringTaskExecuter.java:44)
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.TimeoutTaskExecuter.execute(TimeoutTaskExecuter.java:53)
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SnapshotAfterExecutionTaskExecuter.execute(SnapshotAfterExecutionTaskExecuter.java:38)
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:49)
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:61)
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
11:24:16.811 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:44)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:55)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:35)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:49)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:44)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:337)
11:24:16.812 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:325)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:318)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:304)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: org.gradle.workers.WorkerExecutionException: There was a failure while executing work items
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.DefaultWorkerExecutor.workerExecutionException(DefaultWorkerExecutor.java:161)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.DefaultWorkerExecutor.await(DefaultWorkerExecutor.java:155)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.ec4j.gradle.AbstractEditorconfigTask.perform(AbstractEditorconfigTask.java:128)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
11:24:16.813 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:704)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:671)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:117)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:106)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:85)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 35 more
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing org.ec4j.gradle.runtime.EditorconfigInvoker
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.DefaultWorkerExecutor$WorkerExecution.waitForCompletion(DefaultWorkerExecutor.java:287)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:115)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForCompletion(DefaultAsyncWorkTracker.java:87)
11:24:16.814 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.DefaultWorkerExecutor.await(DefaultWorkerExecutor.java:153)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 50 more
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.nio.charset.UnsupportedCharsetException: utf-8-bom
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.ec4j.gradle.runtime.EditorconfigInvoker.run(EditorconfigInvoker.java:145)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:39)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory$WorkerCallable.call(IsolatedClassloaderWorkerFactory.java:177)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory.executeInWorkerClassLoader(IsolatedClassloaderWorkerFactory.java:105)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory.access$100(IsolatedClassloaderWorkerFactory.java:55)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory$1$1.call(IsolatedClassloaderWorkerFactory.java:79)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory$1$1.call(IsolatedClassloaderWorkerFactory.java:76)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101)
11:24:16.815 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
11:24:16.816 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory$1.execute(IsolatedClassloaderWorkerFactory.java:76)
11:24:16.816 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.DefaultWorkerExecutor$1.call(DefaultWorkerExecutor.java:108)
11:24:16.816 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.workers.internal.DefaultWorkerExecutor$1.call(DefaultWorkerExecutor.java:102)
11:24:16.816 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
11:24:16.816 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
11:24:16.816 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
11:24:16.816 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 3 more
11:24:16.816 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
11:24:16.816 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
11:24:16.816 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
11:24:16.817 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
11:24:16.817 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 0s

Empty files should pass with insert_final_newline = true

Empty files, such as __init__.py cause errors like __init__.py@1,1: Insert lf - violates insert_final_newline = true, reported by org.ec4j.linters.TextLinter when using a .editorconfig file like

root = true

[*]
end_of_line = lf
insert_final_newline = true

Adding a newline to these empty files as a workaround suppresses the error from this plugin, but then fails pylint checks (trailing-newlines check).

Excluding init.py files is also not ideal, as they are often empty, but sometimes contain code that should be checked.

I think the correct behaviour here would be to ignore empty files when checking for trailing newlines.

Plugin should be tied to "validate", not "verify"

Hi,

I believe the "validate" phase of Maven would be more appropriate to tie the plugin to, rather than "verify". "verify" is to check the integrity of the generated artifact (i.e. JAR file) at the end of the build, whereas "validate" is to validate the project before the build starts.

Thanks!

Plugin doesn't respect .editorconfig sections

If I have a .editorconfig file that looks like this

root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.min.css]
insert_final_newline = unset

The plugin will still complain about minified css files not having a trailing newline. The order of the sections makes no difference. I'd expect it to prioritise any matching globs over the [*] global section.

Default excludes are lost if supplied excludes are null

Due to a bug, we currently need something like

<plugin>
  <groupId>org.ec4j.maven</groupId>
  <artifactId>editorconfig-maven-plugin</artifactId>
  <version>0.11</version>
  <configuration>
    <excludes>
      <exclude></exclude>
    </excludes>
  </configuration>
</plugin>

or the default excludes won't be added.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.