Skip to content

Wrong language for syntax highlighting#312

Merged
uhafner merged 3 commits intojenkinsci:mainfrom
akash-manna-sky:JENKINS-64584
Apr 26, 2026
Merged

Wrong language for syntax highlighting#312
uhafner merged 3 commits intojenkinsci:mainfrom
akash-manna-sky:JENKINS-64584

Conversation

@akash-manna-sky
Copy link
Copy Markdown
Contributor

Wrong language for syntax highlighting

Fixes #280

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@akash-manna-sky akash-manna-sky marked this pull request as ready for review April 19, 2026 19:18
@uhafner uhafner added the bug Bugs or performance problems label Apr 21, 2026
StringBuilder after = readBlockUntilLine(stream, Integer.MAX_VALUE);

String language = selectLanguageClass(fileName);
String language = selectLanguageClass(fileName, before, marked, after);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just look in before.

final StringBuilder before, final StringBuilder marked, final StringBuilder after) {
String extension = StringUtils.substringAfterLast(fileName, ".");

if ("ts".equals(extension) && looksLikeMarkup(before, marked, after)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify, no extra method is needed:

Suggested change
if ("ts".equals(extension) && looksLikeMarkup(before, marked, after)) {
if ("ts".equals(extension) && StringUtils.CS.contains(before, QT_LINGUIST_PATTERN)) {

And QT_LINGUIST_PATTERN should be defined as "<!DOCTYPE TS>".

Comment on lines +247 to +248
"<?xml version=\"1.0\" encoding=\"utf-8\"?>",
"<TS version=\"2.1\"><context><name>MainWindow</name></context></TS>"), issue));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you get the example from? All my search results look like:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
  <context>
    <name>MainWindow</name>
    <message>
      <source>Hello, world!</source>
      <translation>Hello, world!</translation>
    </message>
    <message>
      <source>File not found</source>
      <translation>File not found</translation>
    </message>
  </context>
</TS>

@github-actions github-actions Bot requested a review from uhafner April 25, 2026 04:59
Comment thread src/main/java/io/jenkins/plugins/prism/SourcePrinter.java Fixed
@github-actions
Copy link
Copy Markdown

☀️   Quality Monitor

Tests

   JUnit   Unit Tests: ✅ successful — 42 passed, 2 skipped
   🚀   Integration Tests: ✅ successful — 24 passed
   ⛔   Architecture Tests: ✅ successful — 15 passed

Coverage for New Code

   〰️   Line Coverage: 100.00% — perfect 🎉
   ➰   Branch Coverage: 24.14% — 22 missed branches

Coverage for Whole Project

   〰️   Line Coverage: 78.57% — 90 missed lines
   ➰   Branch Coverage: 70.54% — 38 missed branches

Style

   CheckStyle   CheckStyle: No warnings
   PMD   PMD: No warnings
   ☕   Java Compiler: No warnings

Bugs

   SpotBugs   SpotBugs: No bugs
   🐛   Error Prone: No bugs

Vulnerabilities

   🛡️   OWASP Dependency Check: 217 vulnerabilities — error: 17, high: 63, normal: 126, low: 11

Software Metrics

   🌀   Cyclomatic Complexity: 156 (total)
   💭   Cognitive Complexity: 69 (total)
   ➿   N-Path Complexity: 229 (total)
   📏   Lines of Code: 1822 (total)
   📝   Non Commenting Source Statements: 582 (total)
   🔗   Class Cohesion: 100.00% (maximum)
   ⚖️   Weight of Class: 100.00% (maximum)

🚦 Quality Gates

Overall Status: ❗ UNSTABLE

✅ Passed Gates

  • ✅ Overall Tests Success Rate: 100.00 >= 100.00
  • ✅ Line Coverage in New Code: 100.00 >= 90.00
  • ✅ Potential Bugs in Whole Project: 0.00 <= 0.00
  • ✅ Style Violation in Whole Project: 0.00 <= 0.00

❌ Failed Gates

  • ❌ Branch Coverage in New Code: 24.14 >= 90.00

Created by Quality Monitor v4.11.0 (#484bbba). More details are shown in the GitHub Checks Result.

Copy link
Copy Markdown
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@uhafner uhafner merged commit 9727786 into jenkinsci:main Apr 26, 2026
30 checks passed
@akash-manna-sky akash-manna-sky deleted the JENKINS-64584 branch April 26, 2026 07:02
@akash-manna-sky
Copy link
Copy Markdown
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bugs or performance problems

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JENKINS-64584] Wrong language for syntax highlighting

3 participants