Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARD: Fix für Untertitel-URLs #366

Merged
merged 1 commit into from May 16, 2018
Merged

ARD: Fix für Untertitel-URLs #366

merged 1 commit into from May 16, 2018

Conversation

pidoubleyou
Copy link
Contributor

Fixes #365

@@ -189,7 +190,7 @@ private String determineHdFromNormal(final String urlNormal) {
}

private void filmSuchen_old(final String urlSendung, final String thema, final String titel,
Copy link
Member

Choose a reason for hiding this comment

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

MINOR Rename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule

@@ -304,11 +305,11 @@ private void filmSuchen1(final String strUrlFeed, final String thema, final bool
}

private void filmSuchen2(final String urlFilm_, final String thema, final String titel,
Copy link
Member

Choose a reason for hiding this comment

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

CRITICAL Refactor this method to reduce its Cognitive Complexity from 38 to the 15 allowed. rule

private void addThema() {
listeThemen.clear();
MSStringBuilder seite = new MSStringBuilder(Const.STRING_BUFFER_START_BUFFER);
meldungStart();
final GetUrl getUrlIo = new GetUrl(getWartenSeiteLaden());
seite = getUrlIo.getUri(SENDERNAME, ADRESSE_THEMA, StandardCharsets.UTF_8, 5 /* versuche */,
seite, "" /* Meldung */);
seite, "" /* Meldung */);
if (seite.length() == 0) {
Log.sysLog("ARD: Versuch 2");
warten(2 * 60 /* Sekunden */);
Copy link
Member

Choose a reason for hiding this comment

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

MINOR Cast one of the operands of this multiplication operation to a "long". rule

@@ -276,7 +277,7 @@ private void filmSuchen1(final String strUrlFeed, final String thema, final bool
filmSuchen2(url, thema, titel, d, datum, zeit, urlSendung);
}
if (!Config.getStop() && weiter
&& (CrawlerTool.loadLongMax() || thema.equalsIgnoreCase("alpha-Centauri"))) {
&& (CrawlerTool.loadLongMax() || thema.equalsIgnoreCase("alpha-Centauri"))) {
Copy link
Member

Choose a reason for hiding this comment

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

CRITICAL Use already-defined constant 'THEMA_ALPHA_CENTAURI' instead of duplicating its value here. rule

@@ -235,7 +236,7 @@ private void filmSuchen1(final String strUrlFeed, final String thema, final bool
while (!Config.getStop() && (pos = seite1.indexOf(MUSTER_FILM_SUCHEN1, pos)) != -1) {
Copy link
Member

Choose a reason for hiding this comment

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

MINOR Reduce the total number of break and continue statements in this loop to use at most one. rule

@@ -105,7 +106,7 @@ private void addTage() {
thema = thema.substring(0, thema.indexOf(','));
}
datum = seite1
.extract("<title>Videos (TV-Sendungen) des Senders Das Erste vom", "- ARD").trim();
.extract("<title>Videos (TV-Sendungen) des Senders Das Erste vom", "- ARD").trim();
titel = seite1.extract("<h4 class=\"headline\">", "<", pos);
Copy link
Member

Choose a reason for hiding this comment

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

CRITICAL Define a constant instead of duplicating this literal "<h4 class="headline">" 3 times. rule

@alex1702
Copy link
Member

SonarQube analysis reported 46 issues

  • CRITICAL 12 critical
  • MAJOR 7 major
  • MINOR 27 minor

Watch the comments in this conversation to review them.

Top 10 extra issues

Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

  1. CRITICAL MediathekArd.java#L77: Refactor this method to reduce its Cognitive Complexity from 35 to the 15 allowed. rule
  2. CRITICAL MediathekArd.java#L87: Define a constant instead of duplicating this literal "Leere Seite: " 6 times. rule
  3. CRITICAL MediathekArd.java#L94: Use already-defined constant 'MUSTER_ADD_TAGE' instead of duplicating its value here. rule
  4. CRITICAL MediathekArd.java#L102: Define a constant instead of duplicating this literal "&" 4 times. rule
  5. CRITICAL MediathekArd.java#L122: Define a constant instead of duplicating this literal "<a href="/tv/" 3 times. rule
  6. CRITICAL MediathekArd.java#L124: Define a constant instead of duplicating this literal "http://www.ardmediathek.de/tv/" 3 times. rule
  7. CRITICAL MediathekArd.java#L220: Refactor this method to reduce its Cognitive Complexity from 40 to the 15 allowed. rule
  8. CRITICAL MediathekArd.java#L390: Define a constant instead of duplicating this literal "?url=" 6 times. rule
  9. MAJOR MediathekArd.java#L117: Either remove or fill this block of code. rule
  10. MAJOR MediathekArd.java#L205: This block of commented-out lines of code should be removed. rule

@@ -105,7 +106,7 @@ private void addTage() {
thema = thema.substring(0, thema.indexOf(','));
}
datum = seite1
.extract("<title>Videos (TV-Sendungen) des Senders Das Erste vom", "- ARD").trim();
.extract("<title>Videos (TV-Sendungen) des Senders Das Erste vom", "- ARD").trim();
titel = seite1.extract("<h4 class=\"headline\">", "<", pos);
dauer = seite1.extract("<p class=\"subtitle\">", "<", pos);
Copy link
Member

Choose a reason for hiding this comment

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

CRITICAL Define a constant instead of duplicating this literal "<p class="subtitle">" 3 times. rule

@@ -379,8 +380,8 @@ private void filmSuchen2(final String urlFilm_, final String thema, final String
}
String subtitle = seite2.extract("subtitleUrl\":\"", "\"");
if (!subtitle.isEmpty()) {
if (!subtitle.startsWith("http://www.ardmediathek.de")) {
subtitle = "http://www.ardmediathek.de" + subtitle;
if (!subtitle.startsWith("http")) {
Copy link
Member

Choose a reason for hiding this comment

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

MAJOR Merge this if statement with the enclosing one. rule

@alex1702 alex1702 merged commit a1ecc3f into master May 16, 2018
@alex1702 alex1702 deleted the hotfix/365 branch June 8, 2018 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants