Showing 9 of 57 total issues
Function mePlayer
has 240 lines of code (exceeds 25 allowed). Consider refactoring. Open
root.mePlayer = function(options) {
// 检查必填选项
if (!(options.music && options.music.src)) {
console.error('必须指定音乐地址哦~')
return
Function mePlayer
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
root.mePlayer = function(options) {
// 检查必填选项
if (!(options.music && options.music.src)) {
console.error('必须指定音乐地址哦~')
return
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File main.js
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { THEME_DEFAULT, THEME_MINI } from './constants'
import * as lyric from './lyric'
import * as utils from './utils'
import * as spectrum from './spectrum'
import * as selector from './selector'
Function handlePlayClick
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handlePlayClick() {
var _handleMouseWheel
if (audio.paused) {
audio.play()
Function handleTimeUpdate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleTimeUpdate() {
var curTime = audio.currentTime
var curTimeForLrc = audio.currentTime.toFixed(3)
var playPercent = 100 * (curTime / duration)
Function parse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function parse(text) {
var lyric = text.split('\n')
var lrc = []
var len = lyric.length
var reg1 = /\[(\d{2}):(\d{2})\.(\d{2,3})]/g
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function parse
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parse(text) {
var lyric = text.split('\n')
var lrc = []
var len = lyric.length
var reg1 = /\[(\d{2}):(\d{2})\.(\d{2,3})]/g
Function handleMouseWheel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function handleMouseWheel() {
var timer = null
var step = 0.05
_handleMouseWheel = function(event) {
if (timer) {
Function currentIndex
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function currentIndex(time) {
if (time < lyrics[0].time) return 0
for (var i = 0, l = lyrics.length; i < l; i++) {
if (
time >= lyrics[i].time &&
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"