MCPcopy Create free account
hub / github.com/cometchat/cometchat-uikit-angular / checkFile

Function checkFile

scripts/verify-angular-compatibility.js:138–174  ·  view source on GitHub ↗

* Check a file for version-specific patterns

(filePath)

Source from the content-addressed store, hash-verified

136 * Check a file for version-specific patterns
137 */
138function checkFile(filePath) {
139 const content = fs.readFileSync(filePath, 'utf8');
140 const relativePath = path.relative(process.cwd(), filePath);
141 const issues = [];
142
143 versionSpecificPatterns.forEach((check) => {
144 const matches = content.match(check.pattern);
145 if (matches) {
146 matches.forEach((match) => {
147 // Get line number
148 const lines = content.substring(0, content.indexOf(match)).split('\n');
149 const lineNumber = lines.length;
150
151 const issue = {
152 file: relativePath,
153 line: lineNumber,
154 pattern: check.name,
155 match: match.trim(),
156 since: check.since,
157 severity: check.severity,
158 description: check.description,
159 };
160
161 if (check.severity === 'error') {
162 results.errors.push(issue);
163 results.passed = false;
164 } else {
165 results.warnings.push(issue);
166 }
167
168 issues.push(issue);
169 });
170 }
171 });
172
173 return issues;
174}
175
176/**
177 * Print results

Callers 1

mainFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected