Showing 47 of 264 total issues
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { homepage, version } = config;
const { starCount } = this.props;
return (
Function postsMetric
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const postsMetric = (posts: Post[]): PostsMetric => {
const postMetrics = postMetric(posts);
const postsByDays = () => {
const days = {};
postMetrics.forEach(met => {
Function render
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { metric } = this.props;
return (
<Card title={`Time Range Summary, ${timeRangeToString(metric.dateStart, metric.dateEnd)}`}>
Function Post
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Post = (props: UserMetric) => {
const {
picture,
name,
url,
Function commentsMetric
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const commentsMetric = (comments: Comment[]): CommentsMetric => {
const commentMetrics: CommentMetric[] = commentMetric(comments);
const commentsByDays = () => {
const days = {};
commentMetrics.forEach(met => {
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { feeds } = this.props;
return (
Function render
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
const { list, ChildNode, hideNavigationOnSinglePage, perPage, Wrapper } = this.props;
const { page } = this.state;
// handle default props
- 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 render
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { members, posts, comments, data, onFormChange } = this.props;
const metric: TimeRangeMetric = timeRangeMetricer(data.dateStart, data.dateEnd, posts, members, comments);
const metrics: TimeRangeMetric[] = metric.getTimeSeries(data.granularity);
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { members, posts, comments, data, onFormChange } = this.props;
const metric: TimeRangeMetric = timeRangeMetricer(data.dateStart, data.dateEnd, posts, members, comments);
const metrics: TimeRangeMetric[] = metric.getTimeSeries(data.granularity)
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { data, error } = this.state;
const onFormChange = this.onFormChange;
const lookUpGroup = this.lookUpGroup;
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { loading, inputs, manages, features } = this.props;
return !loading? (
<div className="row">
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { metrics, show, title } = this.props;
const fixShow = show || defaultShow;
Function userMetric
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const userMetric = (members: Member[], posts: Post[], comments: Comment[]): UserMetric[] => {
// create user mapping
const users = {};
_.each(members, member => {
const id = member.id;
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { profile, loading } = this.props;
return (
<header className="app-header navbar" style={{ paddingRight: '15px' }}>
Function Card
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Card = props => {
const { id, name, cover, owner, privacy } = props;
return (
<div>
<MediaQuery minDeviceWidth={320} maxWidthDevice={736} minWidth={320} maxWidth={736}>
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { list } = this.props;
const parsedList = list.map((li: UserMetric) => ({
profile: (<div>
Function timeRangeMetric
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const timeRangeMetric = (dateStart: Date, dateEnd: Date, posts: Post[], members: Member[], comments: Comment[]): TimeRangeMetric => {
// pick date
const filteredPosts = posts.filter(post => moment(post.created_time) >= dateStart && moment(post.created_time) < dateEnd);
const filteredComments = comments.filter(comm => moment(comm.created_time) >= dateStart && moment(comm.created_time) < dateEnd);
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { metric, type } = this.props;
const date = timeRangeToString(metric.dateStart, metric.dateEnd);
Function getGroupComments
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getGroupComments = (posts: Object[]): Promise<any> => {
// currently just put existing comments without fetching next page
const firstComments = [];
const secondComments = [];
// get post with comments
Function Login
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Login = () => {
return (
<div style={styles.container}>
<MediaQuery minDeviceWidth={320} maxWidthDevice={736} minWidth={320} maxWidth={736}>
{(matches) => {