See #2831598: Two SVG icons have crlf line endings, where a couple of the SVG files that make up Drupal 8.x core were found to have CRLF (Windows-style) line endings. In particular, see comment #4, which references directions for setting up .gitconfig to correct CRLF line endings. If they can be auto-corrected on upload (or just rejected with a notice to fix the issue on the user side) this should prevent the issue from re-occurring. Note that, if the d.o. repository system already follows the practices outlined in https://www.drupal.org/node/1542048 (as it should, presumably), there may be some tweaks needed (and that documentation may need to be corrected or updated).

Comments

LoMo created an issue. See original summary.

lomo’s picture

Issue summary: View changes
lomo’s picture

Issue summary: View changes
lomo’s picture

Title: Fix Drupal.org Git settings to ensure no CLRF -terminated patches can be submitted » Fix Drupal.org Git settings to ensure no CRLF -terminated patches can be submitted
Issue summary: View changes

Maybe this can be closed as the .svg was addressed with a simple change to the d8 .gitattributes file. But maybe it would also be possible to check any patch (for any kind of file, including any new file types that might not yet be addressed by the .gitattributes) for CRLF line endings (and let the person uploading said patch fix the files in question).

dddave’s picture

Project: Drupal.org site moderators » Drupal.org customizations
Version: » 7.x-3.x-dev
Component: Project/Git problem » Code
drumm’s picture

Title: Fix Drupal.org Git settings to ensure no CRLF -terminated patches can be submitted » Add code sniffs for line endings / SVG
Project: Drupal.org customizations » DrupalCI: Drupal.org Testing Infrastructure
Version: 7.x-3.x-dev »
Component: Code » User interface
Category: Bug report » Feature request

I don’t think this would make sense as a Git restriction. If I’m mirroring a repository to Drupal.org, I don’t want commits blocked, forcing me to make divergent history. Or if I were a developer treating an SVG as a binary-ish file, I don’t care much about the line endings inside.

I could see adding code sniffs for detecting bad line endings.

This also made me think of a code sniff for scripts embedded in SVG. SVGs can have inline JS, which we rarely want in a Drupal project. A sniff would help maintainers spot that if they are treating SVGs as binary-ish.

Mixologic’s picture

Project: DrupalCI: Drupal.org Testing Infrastructure » Coder
Version: » 8.x-2.x-dev
Component: User interface » Review/Rules

Drupalci just runs the rules provided to it, which are in the coder module. Moving.