Skip to content

GetRelativePath cwd replacement too naive #121

@mweinelt

Description

@mweinelt

I'm setting up editorconfig-checker for https://github.com/freifunk-gluon/gluon. Some file paths get shortened wrongly like so:

[...]
package.-web-model/Makefile:
	9: Wrong indentation type(spaces instead of tabs)
	10: Wrong indentation type(spaces instead of tabs)
package.-web-model/files/lib/gluon/web/www/static/gluon-web-model.js:
	Wrong line endings or new final newline
package.-web-model/javascript/gluon-web-model.js:
	59: Wrong indentation type(spaces instead of tabs)
	60: Wrong indentation type(spaces instead of tabs)
	61: Wrong indentation type(spaces instead of tabs)
package.-web-network/Makefile:
	13: Wrong indentation type(spaces instead of tabs)
	14: Wrong indentation type(spaces instead of tabs)
package.-web-node-role/Makefile:
	9: Wrong indentation type(spaces instead of tabs)
	10: Wrong indentation type(spaces instead of tabs)
package.-web-osm/Makefile:
	9: Wrong indentation type(spaces instead of tabs)
package.-web-osm/files/lib/gluon/web/www/static/gluon-web-osm.js:
	Wrong line endings or new final newline
package.-web-private-wifi/Makefile:
	10: Wrong indentation type(spaces instead of tabs)
	11: Wrong indentation type(spaces instead of tabs)
package.-web-wifi-config/Makefile:
	10: Wrong indentation type(spaces instead of tabs)
	11: Wrong indentation type(spaces instead of tabs)
package.-wireless-encryption/Makefile:
	9: Wrong indentation type(spaces instead of tabs)
	10: Wrong indentation type(spaces instead of tabs)
package..mk:
	11: Wrong indentation type(spaces instead of tabs)
	37: Wrong indentation type(spaces instead of tabs)
	38: Wrong indentation type(spaces instead of tabs)
	64: Wrong indentation type(spaces instead of tabs)
	71: Wrong indentation type(spaces instead of tabs)
	109: Wrong indentation type(spaces instead of tabs)
[...]

The file names in question should actually be:

  • package/gluon-web-model/Makefile
  • package.gluon-web-model/files/lib/gluon/web/www/static/gluon-web-model.js
  • package.gluon-web-model/javascript/gluon-web-model.js
  • [...]
  • package/gluon.mk

The working directory where I'm running this in is /gluon inside a docker container.

The command I'm running is

ec .github contrib docs package scripts targets tests *.* .luacheckrc .editorconfig .ecrc

The issue stems from here:

relativePath := strings.Replace(filePath, cwd, ".", 1)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions