Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 8a4c8d5

Browse files
author
Cdok
committed
update error message in copyright tool
1 parent a024673 commit 8a4c8d5

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

copyright/copyright.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const currentYear = new Date().getFullYear()
2020
const langs = {}
2121

2222
let lintMode = true
23-
let updateMode = false
2423
let error = false
2524

2625
// we don't want to pass node and copyright.js directories to the glob
@@ -89,7 +88,6 @@ if (args.length === 0 || args.indexOf('--help') >= 0) {
8988
Options:
9089
9190
--fix run in fix mode
92-
--update update the year in existing headers
9391
9492
Visit ${cyan}https://github.com/mobify/mobify-code-style${defaultFG} to learn more.
9593
`)
@@ -103,11 +101,6 @@ if (args.indexOf('--fix') >= 0) {
103101
lintMode = false
104102
}
105103

106-
if (args.indexOf('--update') >= 0) {
107-
args.splice(args.indexOf('--update'), 1)
108-
updateMode = true
109-
}
110-
111104
buildSupportedExtensions()
112105

113106
args
@@ -119,7 +112,7 @@ args
119112
const ext = file.match(/\.[0-9a-z]+$/i)[0]
120113
let newData = ''
121114

122-
if (hasCopyrightHeader && updateMode) {
115+
if (hasCopyrightHeader && !lintMode) {
123116
let previousHeaderYear = content.toString().match(/(?:\(c\))(?:\s)(\d{4})/)[1]
124117
if (previousHeaderYear !== currentYear.toString()) {
125118
newData = content.toString().replace(`(c) ${previousHeaderYear}`, `(c) ${currentYear}`)
@@ -152,7 +145,7 @@ args
152145
})
153146

154147
if (error) {
155-
console.log(`${red}${blackBG}ERROR${defaultBG} - Please run the copyright headers tool in this project`)
148+
console.log(`${red}${blackBG}ERROR${defaultBG} - Some source files are missing copyright headers. Please run 'copyright --fix' on these files. Mobify projects are configured with an npm run task named 'copyright:fix' that you can use to do this.`)
156149
process.exit(1)
157150
} else {
158151
console.log(`${cyan}Copyright headers are present in target files`)

0 commit comments

Comments
 (0)