Shebang Removal While Adding Copyright Header in Shell Scripts

Đang mở
#2,270 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
shell
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện cấu hình Spotless Maven được cung cấp trên các shell script, sử dụng Maven 3.8.8 và các thiết lập shell licenseHeader. Theo dõi cách setLicenseHeaderYearsFromGitHistory và skipLinesMatching tương tác với nhau, sau đó xác minh rằng việc áp dụng formatter vẫn giữ nguyên shebang của từng script.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug-unconfirmed
  • summary of problem
    I’m working on a project with shell scripts and trying to add a copyright header that includes the year range from the Git history using the setLicenseHeaderYearsFromGitHistory property.

The issue I’m facing is that the shebang (#!/bin/bash, etc.) is getting removed from the script files in the process. It seems there's something wrong with the code flow
image

  • Gradle or Maven version - Maven 3.8.8
  • spotless version - 2.43.0
  • operating system and version - MacOS 14
  • copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible
<plugin>
  <groupId>com.diffplug.spotless</groupId>
  <artifactId>spotless-maven-plugin</artifactId>
  <version>2.43.0</version>
  <configuration>
    <setLicenseHeaderYearsFromGitHistory>true</setLicenseHeaderYearsFromGitHistory>
    <upToDateChecking>
      <enabled>false</enabled>
    </upToDateChecking>
    <java>
      <includes>
        <include>src/main/java/**/*.java</include>
        <include>src/test/java/**/*.java</include>
      </includes>
      <licenseHeader>
        <content>
          <![CDATA[
  /**
  ****************************************************************************
  **   Copyright Header
  ****************************************************************************
  **/]]>
        </content>
        <delimiter>package</delimiter>
      </licenseHeader>
    </java>
    <shell>
        <includes>
          <include>**/*.sh</include>
        </includes>
        <licenseHeader>
          <content>
            <![CDATA[
  #---------------------------------------------------------------------------
  #   Copyright Header
  #---------------------------------------------------------------------------]]>
          </content>
          <delimiter>## Start</delimiter>
          <skipLinesMatching>#\!/bin/sh</skipLinesMatching>
        </licenseHeader>
    </shell>
  </configuration>
</plugin>
  • copy-paste the full content of any console errors emitted by gradlew spotless[Apply/Check] --stacktrace - maven plugin

Thanks in advance

Ngôn ngữ chính
Java
Star
5.7k
Fork
560
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
43

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của diffplug/spotless

Tất cả issue của diffplug/spotless

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.