src/js/main.js
Function mePlayer
has 240 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
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
Open
function handlePlayClick() {
var _handleMouseWheel
if (audio.paused) {
audio.play()
Function handleTimeUpdate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function handleTimeUpdate() {
var curTime = audio.currentTime
var curTimeForLrc = audio.currentTime.toFixed(3)
var playPercent = 100 * (curTime / duration)
Function handleMouseWheel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(function handleMouseWheel() {
var timer = null
var step = 0.05
_handleMouseWheel = function(event) {
if (timer) {