Skip to content

Conversation

xf-
Copy link
Contributor

@xf- xf- commented May 13, 2019

Why?
Add a linter to ensure consistent/unified code style.

Why this less liniter?
Other linter had nicer output, but was slower and no clear name of broken rule.

Config
Different config formats supported:
.lesshintrc (no highlight by default - json)
.lesshintrc.json (json with highlight - easy to find - currently used)
.lesshintrc.y?ml
package.json

Rules
Some rules from default stylish ruleset are disabled because of heavy usage. Maybe some can be removed, but changes some styles.

https://github.com/lesshint/lesshint/blob/master/lib/linters/README.md

{
  "idSelector": false, // is used
  "importPath": false, // less path _ import stuff  
  "importantRule": false, // often used and with heavy deep nesting hard to resolve
  "maxCharPerLine": false, // language & font stuff
  "propertyOrdering": false, // lot of work and not that important
  "qualifyingElement": false, 
  "spaceAroundComma": false, // looks broken and complains about correct syntax
  "stringQuotes": "double", // Singlequote are the default option
  "universalSelector": false, // Do not use * usage
  "zeroUnit": "no_unit" 
}

Exit codes for drone
https://github.com/lesshint/lesshint#exit-status-codes

@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label May 13, 2019
@codecov-io
Copy link

codecov-io commented May 13, 2019

Codecov Report

Merging #6936 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #6936      +/-   ##
=========================================
+ Coverage    41.4%   41.4%   +<.01%     
=========================================
  Files         441     441              
  Lines       59736   59736              
=========================================
+ Hits        24731   24732       +1     
+ Misses      31767   31765       -2     
- Partials     3238    3239       +1
Impacted Files Coverage Δ
modules/process/manager.go 76.81% <0%> (-4.35%) ⬇️
modules/log/log.go 68.9% <0%> (-2.53%) ⬇️
routers/repo/view.go 43.03% <0%> (+1.01%) ⬆️
modules/avatar/avatar.go 100% <0%> (+18.75%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c0fc6cd...d9f4134. Read the comment docs.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 13, 2019
@lafriks lafriks added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label May 13, 2019
@lafriks lafriks added this to the 1.9.0 milestone May 13, 2019
@lunny lunny merged commit 3957b40 into go-gitea:master May 14, 2019
@silverwind
Copy link
Member

Good idea adding a linter. Generally, I came to prefer stylelint, maybe something we want to migrate to later.

@xf- xf- deleted the task/cleanLess branch May 14, 2019 21:00
@xf-
Copy link
Contributor Author

xf- commented May 14, 2019

@silverwind no problem with it. Should be easy to use a similar ruleset I tried a few linter for less (i normally work with yarn, sass and a gulp pipeline) and this one was the fastest. I searched based on links in lessc tool i found.

@silverwind
Copy link
Member

FYI stylelint replacement up in #7305.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants