Merge pull request #3992 from thornbill/fix-major-sonar-issues

This commit is contained in:
Bill Thornton 2022-10-05 07:06:07 -04:00 committed by GitHub
commit 73eae86de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 14 deletions

View File

@ -51,6 +51,7 @@ module.exports = {
'no-floating-decimal': ['error'],
'no-multi-spaces': ['error'],
'no-multiple-empty-lines': ['error', { 'max': 1 }],
'no-nested-ternary': ['error'],
'no-restricted-globals': ['error'].concat(restrictedGlobals),
'no-return-assign': ['error'],
'no-return-await': ['error'],
@ -58,14 +59,14 @@ module.exports = {
'no-trailing-spaces': ['error'],
'@babel/no-unused-expressions': ['error', { 'allowShortCircuit': true, 'allowTernary': true, 'allowTaggedTemplates': true }],
'no-useless-constructor': ['error'],
'no-var': ['error'],
'no-void': ['error', { 'allowAsStatement': true }],
'no-nested-ternary': ['error'],
'no-warning-comments': ['warn', { 'terms': ['fixme', 'hack', 'xxx'] }],
'one-var': ['error', 'never'],
'padded-blocks': ['error', 'never'],
'prefer-const': ['error', { 'destructuring': 'all' }],
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }],
'@babel/semi': ['error'],
'no-var': ['error'],
'space-before-blocks': ['error'],
'space-infix-ops': 'error',
'yoda': 'error',

View File

@ -390,7 +390,8 @@ import { appRouter } from '../appRouter';
} else if (options.indexBy === 'ProductionYear') {
newIndexValue = item.ProductionYear;
} else if (options.indexBy === 'CommunityRating') {
newIndexValue = item.CommunityRating ? (Math.floor(item.CommunityRating) + (item.CommunityRating % 1 >= 0.5 ? 0.5 : 0)) + '+' : null;
const roundedRatingDecimal = item.CommunityRating % 1 >= 0.5 ? 0.5 : 0;
newIndexValue = item.CommunityRating ? (Math.floor(item.CommunityRating) + roundedRatingDecimal) + '+' : null;
}
if (newIndexValue !== currentIndexValue) {

View File

@ -2478,8 +2478,8 @@ class PlaybackManager {
playMethod = 'DirectPlay';
} else if (mediaSource.StreamUrl) {
// Only used for audio
playMethod = 'Transcode';
mediaUrl = mediaSource.StreamUrl;
// Use the default playMethod value of Transcode
} else if (mediaSource.SupportsDirectPlay || mediaSource.SupportsDirectStream) {
directOptions = {
Static: true,

View File

@ -67,7 +67,7 @@ function getDeviceHtml(device) {
}
function getTunerName(providerId) {
switch (providerId = providerId.toLowerCase()) {
switch (providerId.toLowerCase()) {
case 'm3u':
return 'M3U';

View File

@ -202,7 +202,7 @@ export default function (page, providerId, options) {
}
function getTunerName(providerId) {
switch (providerId = providerId.toLowerCase()) {
switch (providerId.toLowerCase()) {
case 'm3u':
return 'M3U Playlist';
case 'hdhomerun':

View File

@ -106,7 +106,7 @@ export default function (page, providerId, options) {
}
function getTunerName(providerId) {
switch (providerId = providerId.toLowerCase()) {
switch (providerId.toLowerCase()) {
case 'm3u':
return 'M3U Playlist';
case 'hdhomerun':

View File

@ -192,7 +192,7 @@ function deleteProvider(page, id) {
}
function getTunerName(providerId) {
switch (providerId = providerId.toLowerCase()) {
switch (providerId.toLowerCase()) {
case 'm3u':
return 'M3U';
case 'hdhomerun':
@ -207,7 +207,7 @@ function getTunerName(providerId) {
}
function getProviderName(providerId) {
switch (providerId = providerId.toLowerCase()) {
switch (providerId.toLowerCase()) {
case 'schedulesdirect':
return 'Schedules Direct';
case 'xmltv':
@ -218,7 +218,7 @@ function getProviderName(providerId) {
}
function getProviderConfigurationUrl(providerId) {
switch (providerId = providerId.toLowerCase()) {
switch (providerId.toLowerCase()) {
case 'xmltv':
return '#/livetvguideprovider.html?type=xmltv';
case 'schedulesdirect':

View File

@ -459,7 +459,8 @@ const scrollerFactory = function (frame, options) {
*/
function dragHandler(event) {
dragging.released = event.type === 'mouseup' || event.type === 'touchend';
const pointer = dragging.touch ? event[dragging.released ? 'changedTouches' : 'touches'][0] : event;
const eventName = dragging.released ? 'changedTouches' : 'touches';
const pointer = dragging.touch ? event[eventName][0] : event;
dragging.pathX = pointer.pageX - dragging.initX;
dragging.pathY = pointer.pageY - dragging.initY;
dragging.path = Math.sqrt(Math.pow(dragging.pathX, 2) + Math.pow(dragging.pathY, 2));

View File

@ -183,9 +183,9 @@
width = height * (16.0 / 9.0);
}
return standardWidths.sort(function (a, b) {
return Math.abs(width - a) - Math.abs(width - b);
})[0];
standardWidths.sort((a, b) => Math.abs(width - a) - Math.abs(width - b));
return standardWidths[0];
}
/**