<commit_before>'use strict';

var colors = require('colors');
var config = require('./config');
var _ = require('./localization');

var data;
var postsCount = 0;

colors.setTheme(config.theme);

var setData = function(d) {
  data = d;
  postsCount = d.length;
};

var clearScreen = function(){
  console.log('\u001b[2J\u001b[0;0H');
};

var renderNumberOfPosts = function() {
  var posts = _('quantityPosts').main.bold + postsCount.toString().second;
  console.log(posts);
};

var renderWall = function () {
  clearScreen();
  renderNumberOfPosts();

  for (var i = 0; i < postsCount; i++) {
    renderPost(i);
  }

  console.log('\n-------------------------\n'.main);
};

var renderPost = function (index, full) {
  var currentPost = data[index];
  var content = currentPost.message || '';
  var likesCount = currentPost.likes ? currentPost.likes.data.length : 0;
  var commentsCount =
    currentPost.comments ?
    currentPost.comments.data.length :
    0;

  content = full ? content : content.substr(0, 150) + '...';

  if (full) {
    clearScreen();
  }

  console.log('\n');
  console.log('-------------------------'.main);
  console.log( _('postNumber').main + index.toString().main);
  console.log( _('author ').main.bold, currentPost.from.name.second);
  console.log( _('contents ').main.bold + content.second);

  if (!full) {
    console.log(
      _('likes').main.bold + likesCount.toString().second + '| '
      _('comments ').main.bold + commentsCount.toString().second
    );
  } else {
    renderLikes(currentPost.likes);
    renderComments(commentsCount, currentPost.comments);
    console.log('-------------------------\n'.main);
  }
};

var renderLikes = function (likes) {
  var like = likes ?
      likes.data.length.toString().second + ' [ '.main +
      likes.data.map(function(l) {
        return l.name;
      }).join(', ').second + ' ]'.main : 0;

  console.log( _('likes').main.bold + like);
};

var renderComments = function(count, comments) {

  console.log( _('\n' + 'comments' + '\n').main.bold);
  if (count > 0) {
    for (var i = 0; i < count; i++) {
      renderComment(comments.data[i]);
    }
  } else {
    console.log( _('lack').disable.italic);
  }
};
<commit_msg>[JSNEWS-CLIENT] - :beer: lint fixes<commit_after>'use strict';

var colors = require('colors');
var config = require('./config');
var _ = require('./localization');

var data;
var postsCount = 0;

colors.setTheme(config.theme);

var setData = function(d) {
  data = d;
  postsCount = d.length;
};

var clearScreen = function(){
  console.log('\u001b[2J\u001b[0;0H');
};

var renderNumberOfPosts = function() {
  var posts = _('quantityPosts').main.bold + postsCount.toString().second;
  console.log(posts);
};

var renderWall = function () {
  clearScreen();
  renderNumberOfPosts();

  for (var i = 0; i < postsCount; i++) {
    renderPost(i);
  }

  console.log('\n-------------------------\n'.main);
};

var renderPost = function (index, full) {
  var currentPost = data[index];
  var content = currentPost.message || '';
  var likesCount = currentPost.likes ? currentPost.likes.data.length : 0;
  var commentsCount =
    currentPost.comments ?
    currentPost.comments.data.length :
    0;

  content = full ? content : content.substr(0, 150) + '...';

  if (full) {
    clearScreen();
  }

  console.log('\n');
  console.log('-------------------------'.main);
  console.log( _('postNumber').main + index.toString().main);
  console.log( _('author ').main.bold, currentPost.from.name.second);
  console.log( _('contents ').main.bold + content.second);

  if (!full) {
    console.log(
      _('likes').main.bold + likesCount.toString().second + '| ' +
      _('comments ').main.bold + commentsCount.toString().second
    );
  } else {
    renderLikes(currentPost.likes);
    renderComments(commentsCount, currentPost.comments);
    console.log('-------------------------\n'.main);
  }
};

var renderLikes = function (likes) {
  var like = likes ?
      likes.data.length.toString().second + ' [ '.main +
      likes.data.map(function(l) {
        return l.name;
      }).join(', ').second + ' ]'.main : 0;

  console.log( _('likes').main.bold + like);
};

var renderComments = function(count, comments) {

  console.log( _('\n' + 'comments' + '\n').main.bold);
  if (count > 0) {
    for (var i = 0; i < count; i++) {
      renderComment(comments.data[i]);
    }
  } else {
    console.log( _('lack').disable.italic);
  }
};

{'fraction_non_alphanumeric': 0.2144790257104195, 'fraction_numerical': 0.009021199819576003, 'mean_word_length': 2.8767482517482517, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3255454', 'n_tokens_mistral': 1509, 'n_tokens_neox': 1465, 'n_words': 293}