Showing 14 of 38 total issues
File index.js
has 525 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// import dependencies
var request = require('request'),
charsetParser = require('charset-parser'),
iconv = require('iconv-lite'),
jsdom = require("jsdom");
- Create a ticketCreate a ticket
Function postRequestToDepartment
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.postRequestToDepartment = function (data, cookie, callback) {
var formData = {};
if (this.department === DEPART.MPES) {
- Create a ticketCreate a ticket
Function postRequestToDepartment
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
Parser.prototype.postRequestToDepartment = function (data, cookie, callback) {
var formData = {};
if (this.department === DEPART.MPES) {
- Read upRead up
- Create a ticketCreate a ticket
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 getCurriculumToDeclare
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.getCurriculumToDeclare = function (cookie, callback) {
request({
url: this.department.url + '/student_dilosi.php', method: 'GET',
headers: {'Cookie': cookie},
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
Open
if (data.id === null || data.surname === null ||
data.name === null || data.father === null ||
data.semester === null || data.address === null ||
data.phone === null || data.method === null ||
data.sent_address === null || data.requests === null)
- Create a ticketCreate a ticket
Function getSucceededGrades
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.getSucceededGrades = function (document, callback) {
var courses = [];
try {
if (this.department === DEPART.MPES) {
- Create a ticketCreate a ticket
Function getAnalyticGrades
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.getAnalyticGrades = function (document, callback) {
var courses = [];
try {
if (this.department === DEPART.MPES) {
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
Open
if (data.requests === null || data.address === null ||
data.address2 === null || data.id === null || data.emergency === null ||
data.father === null || data.name === null || data.other === null ||
data.surname === null)
return callback(new Error("JSON data is in wrong format."), null);
- Create a ticketCreate a ticket
Function getUserDetails
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.getUserDetails = function (document, cookie, callback) {
if (this.department === DEPART.MPES) {
try {
var student_name = document.window.document.querySelector('#header_login u').innerHTML;
var student_id = document.window.document.querySelector('#tabs-1 h2').innerHTML.replace('Μητρώο φοιτητή: ', '').replace(/ -.*/i, '').trim();
- Create a ticketCreate a ticket
Function authenticate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.authenticate = function (callback) {
this.getCookie(function (error, cookie) {
if (error)
return callback(error, null);
- Create a ticketCreate a ticket
Function postCurriculumToDeclare
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.postCurriculumToDeclare = function (courses, cookie, callback) {
var formData = {};
if (this.department === DEPART.MPES) {
formData.count_lessons_etous = "1";
- Create a ticketCreate a ticket
Function getExamGrades
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.getExamGrades = function (document, callback) {
var courses = [];
try {
if (this.department === DEPART.MPES) {
- Create a ticketCreate a ticket
Function getIntercalaryExamGrades
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.getIntercalaryExamGrades = function (document, callback) {
var courses = [];
try {
if (this.department === DEPART.MPES) {
- Create a ticketCreate a ticket
Function postCurriculumToDeclare
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
Parser.prototype.postCurriculumToDeclare = function (courses, cookie, callback) {
var formData = {};
if (this.department === DEPART.MPES) {
formData.count_lessons_etous = "1";
- Read upRead up
- Create a ticketCreate a ticket
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"