Tìm cực trị của hàm số \(g\left(x\right)=\dfrac{x^2+x+4}{x+1}\).